Altruism, in anthropology, evolutionary psychology or sociobiology, is an action which is costly to the actor, but beneficial to the recipient. It can be seen in animals, when parents work hard and expose themselves to danger to feed their own children.

Reproduction is not the only way to increase the frequency of a gene - helping someone else with that gene to reproduce helps too. Your genes are interested in making more copies of themselves, not just in getting you to reproduce. (Sorry)

Genes operate with a particular form of fitness utilitarianism: the value of improving the fitness of someone is directly proportional to the amount of shared genes with that person. This includes yourself.

In order to get people to act this way, genes for all sorts of good things evolved - in humans, things like love, sympathy, etc. You are not just interested in reproducing anymore - getting your kids to successfully reproduce is also valuable, as is helping out your family. So, you have to treat them well. Altruism is why people love their children.

Altruism is also why parents go on loving their children for their whole life, but why children eventually grow to love their own children more than their parents. It's because the genetic overlap is the same between the two, but an investment in the fitness of the children is more valuable.