>>1662627[2/3]
The this manifests differs in each species, for example some species spiders have males that are several times smaller than the female, and after they have mated, the female consumes the male. So the males compete less with the females for resources while after performing the final act of passing on genetic material now increases the chance of his offsprings survival by sacrificing himself as a food source.
You could even argue that in some species there are more than two "genders", for example ant colonies. All ants in a colony share the same genetic code so one could argue the colony itself is the organism as a whole, yet within the colony you have the queen, workers, soldiers and drones, all different expressions of the same base genetic code. Only two of these engage in the act of sexual reproduction, but the workers and soldiers are essential to allow this reproduction to happen. So our notion of male and female starts to become a bit less clear cut in such a case.
For humans this specialization has clear advantages as well. In order to be able to gestate and give birth to a newborn human child, a very resources intensive and demanding process, the female has specialization traits different from the male, which also comes at a disadvantage. For example, the wider hips of women allows for easier birthing, something critically important for us big brained freaks. These wider hips however makes them less efficient at running compared to men. The smaller and frailer frame and body mass of women means less energy is required to keep the mother alive while more of that energy can be dedicated to the growth of the unborn child. For men, we can afford to have narrower hips and larger and stronger size, which allows us to provide for and protect our mate during this extremely vulnerable time they have to go through.