The problem with this is that in economic downturns the government often does not have the money to do this. In a downturn tax receipts tend to go down because there is less economic activity. With less being earned, less tax is paid. If government wants to expand its spending it will need to raise more in taxes or borrow more, neither of which are good at stimulating recovery and growth. If, during times of economic growth, government builds up a reserve surplus, then it might have the resources to do things such as infrastructure projects when a downturn comes. Unfortunately governments rarely do this. When money comes in, the pressures are on them to spend it, and if they spend it during the good times, it is not there any more when the bad times come.
Tax taken and spent by government is money that cannot be spent by the private sector. The goods and services that people might have bought, or the investments made possible by their savings do not take place if the government has taken the money to spend on its own projects.
Some commentators say that in a downturn businesses and private citizens are simply not doing the investing, and therefore government has to step in and do some of its own. There might be very good reasons why people are not investing in a downturn, and they are even less likely to invest if government has raised their taxes or by borrowing money to pay for its projects has raised the cost of borrowing.
There are things that government can do to make investment more attractive and encourage more businesses to start up or to expand. It can lower Corporation Tax; it can tweak Capital Gains Tax; it can give small and new businesses a holiday from National Insurance contributions. All of these are on the supply side, where the effort is needed, rather than on the demand side subject to all of the above caveats.