Actually no. Gaijin is short for Gaikokojin. Gaikokojin literally translates to “a person from outside/foreign”. Jin=person/people, Koko = here, Gai - outside/foreign.
The shortened term is considered derogatory among polite Japanese, but as with crude language in most societies it is wide spread. I’ve called people on it only once or twice when they were being asses...caught them up short.
In Chinese the similar term is pronounced Waigouren, or wairen (wai-foreign, ren - person, gou-country so literally person from a foreign country).
Bagster