For the act, see: sex.
It is not obvious why there have to be two sexes.
But having two sexes rather than just being able to reproduce with anyone reduces the possible mating pool by half!
One of the key thesis of Power, Sex, Suicide by Nick Lane (2006).
Also mentioned at:
Analects translation by Robert Eno (2015) 16.7:
Pedobear with the Powerpuff Girls
. Source. But it's not something that he would do himself, unless under extreme cases.
Articles by others on the same topic
Sexual reproduction is reproduction involving fusion of gametes and a life cycle in which meiosis reduces the number of chromosome sets. Fertilization then combines parental contributions. Sexual reproduction can occur through self-fertilization in a hermaphrodite, so two separate individuals are not an essential part of its definition.
In a simple diploid example, a parent with two alleles at a genetic locus transmits one through each haploid gamete. Meiosis, genetic recombination and fertilization create new combinations of existing alleles; mutation supplies new sequence variants. Alternation of generations shows that a multicellular haploid phase can intervene between meiosis and production of gametes.

