Pretty sure that both instances you're talking about (Huawei/Megaupload) are perfect examples of parent's point --- the US is capable of enforcing laws outside of its territory, the EU is not.
The answer is the same as what extends US law to the entire world. 11 aircraft carriers.
This makes playing nice with the US a diplomatically and economically sensible policy, up to a point. I suspect the US will find it encounters that point increasingly often, partly because the rest of the world is also changing and partly because Trump did so much damage to international relations and the US may never fully recover. The ongoing negotiations about global corporate taxation are a good if rather dull example.