He used his wealth to benefit society, but he also effectively set up a system that would stamp and preserve his name and legacy in history. His actions weren't exactly entirely selfless.
This seems to be a common goal for a lot of people once they become very rich. They ask themselves, "what do I do with all this money?", and then they discover that even rich people die... So they attempt to white wash any of their past wrong-doings, and paint themselves as heroes and leave behind a legacy where their name will live on even after they die.
Does it hurt anyone alive today? That's the more important question.
I highly doubt someone as famous as Andrew Carnegie was heavily motivated by having his name on another building.
Link please. Couldn't find em
I believe it was $50 million not $500.
Carnegie, for example, decided that He Really Liked Libraries. So he built a lot of them.
Paul Allen decided that we were wasting everyone's time redoing basic science experiments, so he did a lot of them and put them all online for free forever.
Brian Acton and Jan Koum decided that free, secure messaging should be available to everyone, so they sunk $500M into Open Whisper Systems so it can be a nonprofit with a warchest.
In years past, people have made similar decicions like "there should be a really good hospital in this town, so i am building one", or whatnot.