For a federal court to hear a case it must have both 1) subject matter jurisdiction and 2) personal jurisdiction.
Subject Matter Jurisdiction
Your first issue, does the federal courts have subject matter jurisdiction. Generally, there is only two ways a case gets subject matter jurisdiction: 1) federal question jurisdiction or 2) diversity jurisdiction.
Federal question jurisdiction arises from 28 USC 1331 which provides that federal courts have jurisdiction to decide a case based on federal law or the constitution. (For example the Federal False Claims Act).
Diversity jurisdiction arises from 28 USC 1332(a) which provides that federal courts have jurisdiction to decide a case if 1) the amount in controversy exceeds $75,000 and 2) no plaintiff shares a state of citizenship with any defendant.
In one of the replies, you mention the amount is less than $75,000. Therefore, federal courts would not have subject matter jurisdiction based on diversity jurisdiction.
You do not mention what the case is based on. You need to determine whether the case is based on federal law in order to determine whether federal question jurisdiction would exist.
If the case is not based on federal law, then most likely the case cannot be heard in federal court and the issue of personal jurisdiction is irrelevant and you would need to go to state court.
Personal Jurisdiction
If there is subject matter jurisdiction, the second issue would be whether the federal court in California or New York would have personal jurisdiction. Personal jurisdiction is governed by Federal Rule of Civil Procedure 4(k), with reference to the states long arm statute, and the constitution. Personal jurisdiction is the worst part of the first year of law school for must people, but generally, B (the defendant) must have minimum contacts with jurisdiction for personal jurisdiction to exist. If B does not have sufficient contacts with CA, then California most likely doesn’t have personal jurisdiction over the case.