I believe the words you’re searching for are:
- 鬼佬， or gweilo. Otherwise known as “white devil” or “ghost.”
- 鬼子， gweizi. Mandarin slang.
- 海人， gaijin. It means “outsider,” “alien,” “sea dwelling human.”
- 老外， laowai . It means “old foreigner” literally. It is slang and loosely impolite.
Bonus one, from the Chinese in Singapore and Malaysia:
- 紅毛 or angmo. It means “red headed one,” but is slang for foreigner and can be a bit derogatory depending on how it’s used.
But you can be absolutely sure that it’s derogatory if someone says, “屌你老母，” to you.