In 'The God Delusion' Richard Dawkins mentions a few ways altruism and compassion etc could've evolved in humans (by way of selfish genes).
I remember one fascinating example about Arabian babblers which use altruism to assert dominance. They seek out increasingly dangerous positions to alert the herd of potential predetors. And by feeding others as a way to say 'look at me I am so superior to you I can afford to feed you'. Of course, they are rewarded by getting all the mates.