Genes and memes
I have the K1a1b1a mutation in my genes, a mutation that happened a few thousand years ago. If you have it too, then you're probably one of the millions of people who are distant cousins of mine. Most of us are related, in fact, as we're all descended from just four different women.
Genes spread. The ones that spread, win.
People are not necessarily selfish, but genes are. They're selfish in the sense that the only genes that are around are those that were part of organisms that had grandchildren. We can't assign a personality to a simple bit of data like a gene, but if we could anthropomorphize, we'd say that the gene is looking for opportunities in the environment to exploit, seeking out advantages that help it get reproduced.
Seen this way, the millions and millions of years of slow evolution of species makes perfect sense. A mutation occurs, and if it confers an advantage on the organism that it is part of, that organism has more kids, the gene is spread. If it doesn't, it disappears. This is one reason you need a new flu shot every year--because the flu mutates over time.
Richard Dawkins took this idea and riffed (in a single chapter of The Selfish Gene) on how ideas follow similar patterns. Robert Kearns, for example, created the mutation we know of as the intermittent windshield wiper. Before his invention, all windshield wipers on all cars worked at just one or two speeds. After his invention started showing up on cars, though, other carmakers saw the idea and it reproduced, moving from a few cars to more cars, until, like an advantage spreading through generations of a population, it was on virtually every car.
Or, consider the growth of guacamole as an idea. In less than a generation, it went from an unknown delicacy (the first recipe I saw included mayo) to something commonplace. Tattoos have a similar if more permanent trajectory.
Ideas that spread win. Ideas don't have to be selfish to win, in fact, it turns out that the more generous the interactions an idea produces, the more likely it is to spread. (Back to guac: it spread partly because it's a party food, so people discovered it when others shared it...)