Carnegie gave away libraries to restore his reputation after his association with causing the first Johnstown flood.
He had been a philanthropist before then, and though he gave Johnstown a library, he didn’t stop there. He truly believed that giving people libraries gave them “a chance to have a chance”, if they chose to take it.
Importantly, it was a gift “that keeps on giving”, and nobody can even guess how much good it did for America, other than “a lot”. A that is one of the best gifts that people can give.