The US is the largest research hub in the world, and it offers (or offered) outstanding conditions for research. I believe this to be as old as WW2, and it certainly didn't start with AI. Higher salaries, more diverse career opportunities (academia is more porous to industry in the US than many other countries), and the ability to hire more and better candidates for the workhorses of a lab: PhD students, postdocs, technicians, research scientists.
Re: supply side, undergraduate education (including Master's in some countries) has become basic infrastructure in a developed (or developing) country, and countries like China, ex-USSR or the western European nations have solid traditions in this regard, with many offering comparable (or surpassing) education to the best US universities in specific STEM topics. However, save for China, I believe a majority of these countries have not invested in research to match their growing pool of Master's (or even PhD) graduates.