There are significant barriers to moving (for the employee) and hiring remotely (for employers) which means the salaries don't equalize across regions very well. Employers are mostly competing with other local employers, so there's not much pressure to increase compensation and salaries change slowly.
Considering how much lower the cost for living (compared to eg. SF is) and how much other stuff is covered (insurance, retirement, general infrastructure stuff), the divide is not that big. But it's still there (and pisses me off, too). The company I worked for payed considerably higher salaries for otherwise equal roles located in SF (and constantly complained about the quality they got for their money in SF). That was also often a reason quoted for lower yearly bonuses for the whole company, which again pissed everyone off..
There are many people in China/India who are smarter and harder working and more driven than many people at FANG headquarters. However they're competing with each other in a highly competitive area while in the US there is less competition because of moats dug to create better quality of life. Like how elevators beep when there are too many people to prevent crowding.
So the end reason is very very similar to why any sort of inequality exists at all, just in a more extreme and jarring form because the field in question is supposed to be THE meritocratic field. (Which it is in a way... But most of that disappears in large companies. And in the truly free economic playing ground it's not about smarts but about money and smarts)