With what they're calling "gender," there seems to be a lot of variation, of several factors, and much of it not discrete variations but points on a spectrum or continuum.
Whatever it is in the brain that causes most males to "feel" male, to have male interests and sexual attraction to females; or the converse in females, is little understood, but it is something in brain anatomy, physiology, neural pathways &c, all of which vary from individual to individual. Variations causing non-typical expressions are pretty common.
With sex There are all sorts of variants: X. XX. XXX. XXY XYY, XXXX. XXYY, XXXY. XXXXY, XXXY. XXYY. XXXXX, and others. There are also those with mosaic cell lines, with, for example, both XY + XXY, or X + XXX or other variations in a single individual.
Combine XY variation (aneuroploidies) with neurological variation in the brain, and you can get
a lot of natural, (not learned) variation.