I saw an interesting video on evolutionary biology that can offer a bit of insight.
In computer simulations of simple beings, in which some are greedy and aggressive and some are peaceful and generous. The simulation found that a society of only aggressive beings cannot flourish because they fight and hurt each other too often to reproduce effectively. A society of peaceful beings was the most prosperous as they shared resources equally and supported the large population. However, when in a peaceful society, an aggressive being has a greater chance to reproduce than a peaceful being because other beings will share with it and it keeps all it's resources and won't share. And this greater chance of reproduction means an increased chance of passing on it's genes and so it and it's offspring will spread their genes more effectively than peaceful beings. The aggressive population will continue to grow until they start fighting and hurting each too much, at which point the peaceful being population will grow and reach an equilibrium of a mixed population.
What this showed is that a population of generous beings is the most ideal, but since it's more advantageous for the individual to be aggressive rather than peaceful in that population, the aggressive population will always be there to dominate the peaceful population, Unfortunately natural selection doesn't operate on what's best for the species, it operates on what's best for the individual in order to achieve reproduction, even if the offspring will harm the species. Obviously, this is very simplified and can only be loosely applied to people, but it can offer an evolutionary explanation for greed.