Take a look at the Rashi for Genesis 46:15. Rashi is concerned with why the Torah splits up the sons and daughters of Leah and Yaakov. The sons are described as belonging to Leah and Dinah to Yaakov. So he comes and says that "isha mazraas techila, yoledes zachar, ish mazria techila, yoledes nekeiva" meaning that if a woman gives 'seed' first, she gives birth to a boy, if the man gives seed first, she gives birth to a girl.
As it is well known that women don't have sperm, but the female sexual secretions was thought to be the female equivalent of sperm, what this means here is that if the woman orgasms first during coitus the conceived child will be male, if the man is the first to reach orgasm then the child will be female. Of course, this is highly unlikely and which partner reaches climax first has no bearing whatsoever (or perhaps an extremely marginal bearing) on the gender of the child. It is very possible for a woman to conceive a child of either gender without any orgasm. Some women never have orgasms, yet they do have male babies. But we can't fault Rashi though, he was dealing with Medieval theories of biology and we can't expect him to be an expert.
However, it just so happens that Rashi didn't just make this up himself, nor was it something he picked up from the goyishe society around him. This comes straight from the Talmud.
See if you will, Masechet Niddah Daf 31a. And I quote:
"R. Isaac citing R. Ammi stated: If the woman emits her semen first she bears a male child; if the man emits his semen first she bears a female child; for it is said, 'If a woman emits semen and bear a man-child.'"
That segment that the Gemara refers to is from Leviticus 12:2 where it is discussing the impurity which befalls the woman who gives birth to a male. It uses that phrase. How you can derive from that it is the orgasm which decides the child's gender is anyone's guess. In my pragmatic eyes it just seems like a turn of phrase to indicate that she has conceived and gives birth. But the Talmud regularly makes much from little.
Anway, so the Gemara continues:
"Our Rabbis taught: At first it used to be said that 'if the woman emits her semen first she will bear a male, and if the man emits his semen first she will bear a female', but the Sages did not explain the reason, until R. Zadok came and explained it: These are the sons of Leah, whom she bore unto Jacob in Paddan-aram, with his daughter Dinah, Scripture thus ascribes the males to the females and the females to the males."
And so we have gone full circle. R. Zadok takes us back to Genesis 46:15 to explain this strange exegesis.