I'm totally dumb on this subject but maybe I can spark an answer from somebody who knows. It's understood that germs attack and change cells, sometimes even devouring them, but other times using the "normal" cell to reporduce more of the "germ type" cell. All we need here is for the asexual replicating cell (or self replicating cell) to develope factors that may or may not change it from the original. Call that a chromasome if you like. Now we have 2 types of cells coming from this reproduction that on the grand scale becomes humans (male and female) as we know them today.
Well the quick answer is that some simple life forms can reproduce both sexually and asexually.
Since sexual reproduction is more efficient at gene mixing, that led to more complex life forms. Once sexual reproduction was established there was little selective pressure to go back (though there are a few offshoots like certain lizards that returned to asexual reproduction)
I assume you mean to ask about the evolution of sexual reproduction. There are plants and animals which are hermaphrodites and can fertilize themselves. That is sexual reproduction, but whether it should be called heterosexual reproduction is a question. Asexual reproduction is essentially cloning and does not introduce genetic variety. Asexual reproduction therefore exposes the species to parasites and other environmental stresses.
The evolution of sexual reproduction is not settled. It arose in bacteria over a billion years ago, but the fossil record for bacteria is slim and the exact sequence cannot be drawn from it. There are a number of competing theories and it is possible that sexual reproduction arose in more than one way and at more than one time. Conducting experiments is one way to find out, but you need lots of generations to see what is happening.
There have been theories in the last decade that parasites are responsible for the viability of sexual reproduction—the genetic variety induced by sexual reproduction makes it harder for parasites to find a suitable host. Parasites have also evolved sex to diversify their genes and make their chances of survival greater. Carl Zimmer's book Parasite Rex is a good general account of the role of parasites in evolutionary development.
Sex involves extra expenditure of energy over cloning, but it produces offspring more likely to survive in a hostile world. There are snails which can reproduce sexually or asexually and in a stressful environment they are more likely to use sex, bearing out the hypothesis that sex is a response to environmental stress.
The immense variety of sexual techniques and habits found naturally is still being explored. To give just one example, the clownfish (Nemo in the Disney film) can be both male and female at different times. In a clownfish family there is only one female and one male and the rest are non-breeders, but if the female dies, then the male changes sex and becomes female and the largest of the non-breeders becomes the male. Really astonishing. How all this evolved is a mystery.