The term is a bit confusing. Usually when people refer to extraterritorial prosecution they mean cases where a court in a defendant’s home country prosecutes the defendant for crimes he committed in another country. The defendant is prosecuted at home, so the prosecution is really not extraterritorial, but the crime was committed outside of the country’s territorial jurisdiction. For example, let’s say David from country A commits a crime in country B and is prosecuted for the crime back in country A – – that is usually what people mean when they say extraterritorial prosecution.
In the United States federal laws usually don’t apply to activity committed in other countries. If a US national commits a crime overseas and the crime has no connection to the United States, it is very likely that federal law will not apply to his actions and he cannot be extraterritorially prosecuted back in the US. But there are exceptions. Congress will sometimes expressly state that a federal law applies to conduct by a US national overseas.