Does anyone have an explanation as to how Buddhism explains the reason(s) as to why and how humans are born as men and women? What governs the gender?
The Aggañña Sutta gives a creation style account of human development. In it it says that humans were originally asexual and only later differentiated and grew sex organs. To quote
And as they did so, their bodies became coarser still, and the difference in their looks became even greater. And the females developed female sex organs and the males developed male sex organs. And the women became excessively preoccupied with the men, and the men with the women. Owing to this excessive preoccupation with each other, passion was aroused, and their bodies burnt with lust. And later because of this burning, they indulged in sexual activity.
Bear in mind though that these is a feeling that the entire sutta is a satire on the brahminical claims regarding the divine nature of the caste system.
This lecture titled Kamma and Rebirth says,
According to Buddhism, there are three factors necessary for the rebirth of a human being, that is, for the formation of the embryo in the mother's womb. They are: the female ovum, the male sperm, and the karma-energy (kamma-vega), which in the Suttas is metaphorically called "gandhabba," i.e. "ghost," or "soul." This kamma-energy is sent forth by a dying individual at the moment of his death. The father and mother only provide the necessary physical material for the formation of the embryonic body.
To the extent that gender is a physical phenomenon, perhaps therefore humans are born as men and women because their physical bodies are made that way by their parents' ovum and sperm (gametes).
There's a different theory presented in (for example) HOW REBIRTH TAKES PLACE which says,
With the cessation of the decease-consciousness death actually occurs. Then no material qualities born of mind and food (cittaja and āhāraja) are produced. Only a series of material qualities born of heat (utuja) goes on till the corpse is reduced to dust. 
Simultaneous with the arising of the rebirth consciousness there spring up the 'body-decad,' 'sex-decad,' and 'base-decad' (Kāya-bhāva-vatthu-dasaka). 
According to Buddhism, therefore, sex is determined at the moment of conception and is conditioned by Kamma not by any fortuitous combination of sperm and ovum-cells. 
The passing away of the consciousness of the past birth is the occasion for the arising of the new consciousness in the subsequent birth. However, nothing unchangeable or permanent is transmitted from the past to the present.
I don't understand the source of this theory. The first paragraph of that chapter starts with,
To the dying man at this critical stage, according to Abhidhamma philosophy, is presented a Kamma, Kamma Nimitta, or Gati Nimitta.
... which suggests the theory comes from the Abhidhamma; however the footnotes to those paragraphs are referencing The Tibetan Book of the Dead (which isn't Theravada).
My personal opinion is that "your kamma from previous lives conditions your position in society" is a Hindu belief (see for example Karma in Hinduism - Relation between birth in a particular body to karma).
That seems to me to be a kind of "Identity view (sakkāya-diṭṭhi)", which Buddhism suggests we avoid.