Because they still want to hire lots of Americans. They just don't want to pay them market prices. So they bring in H1-Bs to lower wages. If they hired them overseas, there wouldn't be that effect:
From the article above:
"Research by Daniel Costa, of the left-leaning Economic Policy Institute, and Howard University political science professor Ron Hira, found that 60% of H-1B workers receive lower-than-average wages for their job and region. Google, Facebook and Apple “take advantage of program rules in order to legally pay many of their H-1B workers below the local median wage for the jobs they fill,” Costa and Hira said in an Economic Policy Institute paper."
I'd personally like to see the US adopt a systematic and generous immigration system like Canada's. But the H1-B system has mostly been a farce, used as a weapon against American workers. There are exceptions, but overall, it's most benefited the big tech company stockholders.