>>13260935sex, in a normal development, is indeed binary in most animals, including humans.
gender is exclusive to humans, and exclusive to human experience, etc. The gender of almost all humans matches their sex, and manifests as instincts, expectations, wants, needs, and physical and social aspiration. That is to say, males want to be men, want to grow up to be fathers, have wives (usually), protect their family and teach their sons to be men like them. In turn, females want to be protected by and provided for by a man, to bear his children, and raise those children so they can survive past the infant morality phase that was so common in the human past.
Sometimes, however, by some quirk of genetics (unknown if from the father, mother, or child), some humans develop in utero without the correct balance of hormones. As human embryos develop female by default until the introduction of testosterone, which is released by the mother by some mechanism in her genetic code or her baby's. In some individuals, the wrong hormones, wrong ratios of hormones, or no hormones at all are released, causing the most critical phase of neural development to develop as the default female brain architecture. These individuals inherit the instincts and thought patterns of women, despite otherwise developing as a male would in the body. A more complete form of this phenomenon is known as Swyer's syndrome, in which the genes coding for development of testes do not work at all, so no further male development occurs. These naturally xy women exhibit many of the same symptoms as xy and xxy transgender women.
But don't take my word for it. I encourage you to research this in any prenatal development resources you wish.