Hijra is a third gender used by people in India that was first documented several thousand years ago [0]. There are similar third genders in other Southeast Asian countries.
Galli: a priest/priestess in Hellenistic Greece and Rome that wasn't considered to be man or woman [1].
Muxe: third gender of Mexico that may have pre-dated Spanish colonization [2].
[0] https://en.wikipedia.org/wiki/Hijra_(South_Asia)#History