What Adam Smith was trying to illustrate with his metaphor of the invisible hand was that it doesn’t matter if businessmen have no intention of helping other people. To succeed in the market and thereby help themselves, they must help others. He softened the view of Bernard Mandeville in his Fable of the Bees in which Mandeville argued that private vice is necessary for provision of the public good. “Greed is a necessary evil” as you put it.
Greed is certainly not a necessary evil in society. The market economy operates fine whatever motives people have. They can be greedy, like Donald Trump, or altruistic, like Mother Teresa. All that is necessary for the market economy to function is that we are able to give each other monetary incentive. Consumers do this by buying or refusing to buy products. Entrepreneurs do this by offering or refusing to offer monetary compensation to acquire producer goods. Monetary incentives, as opposed to barter trade, are necessary for economic calculation, But the motive to pile up money, i.e., greed, is not.
Consider historical examples. The fastest growth in the American economy was in the late 19th century. But Americans were certainly less greedy and materialistic back then than now. The fastest growing economy in the world over the last thirty years has been the Chinese. But nobody claims that what happened to spur this grow was massive greed overcoming the Chinese people. Instead, a better performing economy comes as a result of a more market oriented economy.