The question of why there are only two sexes (and genders!) has to do with their biological function. This article is about sex, chromosome numbers and germ cell formation.
Sexuality or sexual reproduction is not only exhausted in the multiplication of the number of individuals, but is based on the constant recombination of the parental genetic material. This ensures a certain variability of the organisms. Sex refers to the totality of all phenomena that are put into this service. The biologist August Weismann has already pointed out the origins and significance of sexuality (WEISMANN 1883, 1886). LANE (2009) has dedicated a chapter on the origins and evolution of sexual reproduction; MARGULIS & SAGAN (1986) also wrote a wonderful book (albeit partially elderly). For visually oriented people, I recommend the following video, also the following.