If it is absolutely necessary to refer to someone's exclusion for logistical (e.g. visa, legal) reasons the usual way to say it is 外國人,外籍人,外賓, the latter of which is usually the most formal and respectful.
I'm curious when and how the name might have attached itself to San Francisco, which is not near Potosí.
Though this may be less true in Taiwan; I think 洋鬼子 is fairly Maoist.
But generally you're missing the point. (1) 老外 (lao wai) is an intrinsically othering term, and (2) it's generally applied by race rather than by national origin. It doesn't matter what the literal translation is. The point is about how the word is used.
Here in California many Chinese-speaking transplants use the terms 老外 or 外國人 to refer to white Americans. I always correct them when they do--pointing out that they are the foreigners. It comes off as rude, but that's the point! No one likes to be ostracized or grouped based on the color of their skin, and that's precisely what they were doing when they used the term to refer to white people in the first place.
If I move my life to China or Taiwan, how long do I have live there before I am no longer 老外? What about my kids who grow up there, speaking at a native level and calling the country their home. Are they 老外 too?
Consistent with this, do you also insist that they refer to the USA as "中國"?
(Actually, there are several synonymous words which are opposites of 外, but in the 中国 / 外国 contrast, the opposite of 外 is obviously 中.)
中國人 is a specific term of nationality. Likewise with 美國人. But 外國人 is different—it is defined only in relation to something else, as The Other. That’s fine in the context of passport control where your nationality matters, and you need to be in the foreigner line. But it’s not okay when we all live together in the same country, speaking the same language and with our kids in the same class in school, and you still refer to me as The Foreigner. Do you see the difference?
Interestingly, A LOT of mainlanders don’t know to line up in the 外國人 line when they go through Taiwan’s passport control, and they get upset when they are told to switch. It happens literally every time I’m in the airport (at least pre-pandemic). I don’t know if this is a dialectical, cultural, or propaganda problem, but it seems related.
Your history is off; the term is very old and does not even originally refer to all of China. It's also the name of a small, non-central part of Japan.
> Interestingly, A LOT of mainlanders don’t know to line up in the 外國人 line when they go through Taiwan’s passport control, and they get upset when they are told to switch.
I think they have a point here; putting mainlanders in the 外國人 line would seem to be an explicit contravention of the One China Policy.
古 gǔ means ancient, like 古人 gǔrén is ancient people. You could construct phrases to mean ancient foreigners, modern immigrants, modern foreign people, etc. but I don't know of any that would carry more special meaning than equivalent phrases in English.