Historically Japanese used to call foreigners 外人 (gaijin) which means foreign person.( or if you wanted to be more specific it technically means "outside person" 外 means "outside" and 人 means "person" though 外人 mostly gets translated as "foreigner" by google translate)
And then over time 外人 was considered to be "rude" and "politically incorrect" because 外人 refers to anyone that was not of Japanese ethnicity even if they had Japanese citizenship, so they started saying 外国人 (Gaikoku jin) which means "foreign country person" (or outside country person though again google translate translates it as "foreigner") which is the term used by the Japanese government and media. There's still people who say 外人 but the mainstream term is now 外国人.
And now there are those that even take it one step further to start saying 海外の人 which means overseas person.
So who exactly was responsible for the political correctness being pushed over there?
This is similar to the bastardization of language in the West. its like how "illegal alien" started becoming "illegal immigrant" and then it became "undocumented immigrant" or even why the West doesn't even describe foreigners in their countries as foreigners anymore, or how "transvestite" became "transgender". Political correctness became so bad that even conservatives stopped using "illegal alien" and started using "illegal immigrant" similar to how even in Japan conservatives started saying 外国人 instead of 外人 even though they are clearly still using the term anytime they see anyone that doesn't look of Japanese ethnicity.
gaijin / gaikokujin -> foreigner
There isn't a word gaikoku hito. You can say "gaikoku NO hito" or kaigai no hito or kaigai kara no hito.
ok i'll edit it. But why does google translate tell me that its gaikoku hito?
Because google translate is kind of shit at Asian languages. Use Deepl instead.
Their transliteration algorithm is confused. But if you click the little speaker icon under that it speaks with the correct pronunciation.