Sex is genetically influenced but hormonally determined. Intersex people are far more common than we hear about. Rates may be as high as 1 in 2000 births.

A person with Androgen Insensitivity Syndrome (AIS) has an XY gene set but is hormonally (and often structurally) female (though sterile). Their bodies can't process androgens like testosterone.

People with AIS, Partial AIS (PAIS), or Complete AIS (CAIS) are one branch of the intersex phenomena. There are many others.