If you print money to buy stocks, the money goes into the capitalists' pockets, where it tends to stay, because capital is already extremely highly concentrated and avenues for investment are few at this scale. Also you get the adverse externalities mentioned by GP.
Whereas if you pay workers for infrastructure, you get some infrastructure (I. E. Productive capital) and the worker will actually spend their money, thus enabling other workers to create value in turn.
All of this is about putting workers to work.
You can try to order the workers to work, with a central planning system (soviet Russia, or any large multinational corporation such as Google) or with money.
But if you give money to rent seekers who are already full of money, they are not going to put workers to work, which is what is currently happening in the West.