The DNA in the energy-producing cell structures called organelles can only be passed through egg cells. As such, organelles would benefit evolutionarily when an organism shifted resources, from being hermaphroditic to being an egg-carrying female.
In turn, this benefit led to the production of so-called male-killer genes, which cause an individual to become female, thereby increasing the species’ ability to reproduce.
With more females around, it became more attractive for other cells to specialize in male reproduction, as doing so would offer them many potential mates and therefore better odds of passing on their genes. In the end, hermaphrodites were no longer sufficiently specialized to compete with the males and females, and the two sexes prevailed.
Even today, the sex of animal offspring is still determined by evolutionary pressures. While many factors influence this process, for the most part, the offspring’s sex is determined according to the evolutionary needs of the species.
Just take male opossums, which tend to be noticeably larger than females, as this helps them fend off predators and, in turn, produce more offspring. As a result, female opossums that are well fed, and can thus have heavier babies, tend to produce more male offspring.
Or consider baboons, for whom status is inherited. High-ranking females in baboon societies give birth to more female offspring who will retain their status, as opposed to males who often leave for another pack.
Not only that, but in 1966, the scientist Valerie Grant found that human women who get high scores on personality tests measuring dominance gave birth to more boys. From this finding, she argued that, evolutionarily, boys with such mothers would benefit more than girls would by inheriting traits related to dominance.