The comparison between sexual and asexual reproduction is actually quite a simple one in terms of their functions. Sexual reproduction happens in order to mix up the genes as much as possible and create variation in the offspring - all of which are unique genetically. Asexual reproduction on the other hand is a cloning process that creates offspring that are all genetically identical.
The theory is that sexual reproduction arose due to the presence of a constantly changing environment. Logically, if the environment is changing and the organism does not change in response - then that organism will die out because it will eventually be unsuitably adapted to its environment. On the other hand, an organism that produces offspring that are genetically different from each other can, over time, change along with the environmental changes, and stay well adapted and not become extinct.
In fact, we humans have been using this variation to our advantage through the process of selective breeding for centuries. If you look at a domestic pig or cow and compare it to its original ancestor - the wild boar and bison respectively - then you will see how much selected genetic variation over time can change the characteristics of the organism. If we think of the environment as acting like humans (except of course it has no purpose) in selecting particular individuals amongst the offspring that happen to be best adapted - then we can imagine how variation can lead to adaptation.
How is sexual reproduction achieved? At the heart of it are the processes of gamete production and fertilisation - in animals the male gamete is sperm - in females it is the egg. In plants the male gamete is the pollen grain while the female gamete is in the ovule in the plants ovaries.
Gamete production occurs by the process of meiosis - a type of cell division which mixes up the parent organism's genetic material as much as possible and halves the amount of DNA so the two gametes can fuse together (fertilisation) to form a new organism with the full amount of DNA. Every gamete is unique genetically and therefore so is every one of the offspring. Even more, further genetic variation results from the fact that the offspring's DNA comes from two genetically unique parents.
On the other hand - asexual reproduction is a reasonable short term strategy as it has the advantage of only involving one organism and is more economic, in not involving the energy output of gamete production and seeking mates etc.
Some organisms - notably plants - have made the best of both worlds by employing both sexual and asexual reproduction. They therefore benefit from the economy and ease of asexual reproduction and the possibility of longer term survival through variation given by sexual reproduction.
Unfortunately, higher animals such as humans cannot reproduce asexually -however we seem to have been rather successful in populating the world anyway!