Carnegie sold his steel to JP Morgan and at the time was the richest individual. He invested that money in over 3000 public libraries and provided education to all. He himself came from a poor family and knew how difficult it was to fight, educate and achieve something. He wanted to change the world for the better and to start positions for all citizens as similarly as possible.
Probably he would still do so today in accordance with the times. So he provided IT education in addition to everything.