Once a case is legitimately in Federal court, all compulsory, related claims can be heard in that court, even if the Federal court wouldn't have the jurisdiction to hear those claims if they were brought independently. For example, in Moore v. New York Cotton Exchange (270 U.S. 593 (1926)) Moore sued the Cotton Exchange under some anti-trust laws. There was no diversity,
but Moore was legitimately in Federal Court based a Federal question jurisdiction. The Cotton Exchange counterclaimed, (under a compulsory counterclaim Rule 13(a)) but the counterclaim was not a Federal Question (and thus the Federal Court had no jurisdiction to hear it). However, yhe US Supreme Court found that the counterclaim could be heard in the Federal Court under ancillary
jurisdiction.
The Cotton Exchange didn't
chose Federal Court, but since the counterclaims were compulsory, if they
didn't bring it here, they'd never be able to bring it. So out of
fairness they have to be allowed to make their claim in Federal Court.