The term "gaijin" (外人) is a shortened form of the official term (by "official", I mean the term that's used in government documents and on the evening news) "gaikokujin" (外国人). That word literally means "outside country person" but is translated to "foreigner". Since "gaijin" is missing "koku" (国) or "country", it comes across as "outsider". The Japanese language shortens seemingly everything, so that connotation might not be intentional.
"San" is an honorific—so combining them, you get "Gaijin-san". The addition of "san" isn't that unusual as Japanese people slap "san" to refer to people whose names they don't know.
Website Debito.org recently noted that the "Hello Gaijin-san Party Joke" has been tweaked. As of this August, it is now the "Ha~i! Gaikokujin desu. Party Joke" or "Hi! I'm a foreigner. Party Joke". Still included is a big nose and blue eyes—because according to the stereotype, all foreigners have both?
Some find the term "gaijin" offensive, saying it carries racist undertones. Personally, I've heard it so much in the decade plus I've been here, I'm numb to it. Now, whether that is a good thing or a bad thing is another issue altogether.
(In short, sometimes people in Japan use the word "gaijin" because it's a common word, and they don't think they are using a word some do not like. Other times, people are just jerks! Instead of simply getting hung up on that word, it's also important to look at the context: who is saying it, why are they saying it, and how are they saying it.)
In this revised party joke, Japanese speakers will be quick to note that the more "P.C." version uses typical "foreigner language", including writing the Japanese "desu" copula (です）in katakana (デス), a writing system often reserved for foreign words.
But the real tweak is that "gaijin-san" was changed to the official term, "gaikokujin". So, I guess, that makes this very clever party joke better? Still, nothing like dressing up like others for laughs! Hilarious.