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
Reproduction is the production of new organisms, maintaining lineages across generations. In asexual reproduction, a parent produces offspring without fusion of gametes; sexual reproduction includes fertilization and, in the usual eukaryotic life cycle, meiosis. A growing organism can add biological cells without producing a new individual, so mitosis alone does not establish organism-level reproduction.
A fern illustrates why reproduction cannot always be represented as an adult giving birth to a similar adult: its sporophyte produces spores, which develop into gametophytes that make gametes. Following both alternation of generations and the number of chromosome sets makes the connection between reproduction and heredity explicit.

