Because going through a struggle tends to turn people inward and makes them see everything, including the harm they do to others, as if they were a victim just doing what they have to do to survive. It is very hard to overcome it because you have to become a kind of martyr, who accepts the reality of their suffering but who's too holy to blame it on everyone else, or even on yourself.
Kids are often nicer than adults because their lives are so easy, but if they don't learn to bear a cross (this is the best metaphor I know) they'll become nasty as they get older, as people reject them and their health starts failing. It's one thing to be a nice young man, another one entirely to be a nice overweight balding 60 year old with joint pain and a skin disease. That's not to say it's about age. It's about how good you feel, and age is just the big conveyor belt that everyone goes down whether they're ahead or behind their demographic.
You can watch this play out in you next time someone says or does something annoying when you're still smarting from a minor injury, like a stubbed toe. You'll tend to act as if they were the ones who stubbed it because blame wants to earth itself.