As for reproduction, energy cost and demand plays a role too. The female produces on average one egg a month, the male can produce a rather countless amount of sperm a month. Basically, a lot more energy is required to produce one egg versus one sperm. Thus, the egg is of much higher value than the sperm is.
Before males were around, it was just females giving birth to females. This was of course way before primates or even dinosaurs evolved. Once the organisms began to get complex, one set of chromosomes was not enough to carry all the genetic information, so evolution devised a plan to have part of more genetic information stored in a separate, inferior symbiotic organism. Males.
The male chromosome was incomplete, but capable of providing additional help to the females. Over time, the male chromosome gained importance as the organism became even more complex. Eventually they began to develop specializations in size and strength because those extra genes had to be purposed for something other than childbirth.
The primary function of a male, from a genetic standpoint is twofold: First, it helps to diversify the species by bringing in information from other than the mother. Diversity is power in nature. Second, it continues the function of sex. The sex of a fetus is determined by the male's contribution in genetic material. An X from mother and father produces a new female as the male adds his mother's contribution to the lineage. An X from the mother and a Y from the father produces a new male as the father adds his own contribution to the lineage.
The female X chromosome therefore forms an unbroken line all the way back to the original females. The males, however, are kind of created anew with each new male birth. Which is why it is far more difficult to trace our lineage back along the lines of our father. We were able to trace our lineage back to a single female in our prehistoric history. But we can't really do this with fathers in most cases.
Genetics are also far from perfect systems. Males are sometimes born with XX chromosomes and females can be born with XY chromosomes as well. Whether this is a genetic mistake or genetics trying to play out different scenarios is still an unanswered question.