When any bank issues a loan, it creates two entries in a ledger. The bank hands over cash in exchange for some type of asset, usually just a promise to pay. So if you ask the bank where its money has gone, it can say that all is well, the cash is not theirs at the moment but instead there is an asset worth just as much. Now add together the two values [ the value of cash loaned out and the value of the loan agreement] and you get - zero, nothing.
Follow this process slowly.
Start with nothing in the bank - no money, no asset.
Then introduce an asset such as a loan agreement or a mortgage, which has a positive money value, but take away the money loaned out to the customer, an equal sum, leaving a combined value of nothing.
Now let's repay the loan: and terminate the loan agreement or mortgage. We are left with - you guessed it, nothing.
What has happened is that the bank has created money out of thin air to match the value of your loan application and that money has vanished back into thin air when you repaid the loan. This is why any textbook on corporate finance will tell you that the amount of money available to invest in your business ideas is infinite. What is in short supply is credible business ideas.
Now apply this same process to government spending. When the government invests in productive projects such as a new hospital or road, then in principle the amount of money available is infinite, for the same reason as any bank loan. The money is not your money or someone else's money. The government creates it.
The issue is only to decide if the government's ideas for investment are good ones or bad ones. Exactly the same as for bank loans.
So what do taxes pay for? They enter the ledger and vanish into thin air, just the same as loan repayments to a bank. In the meanwhile taxes do a lot of useful things and some not useful things but they do not provide the money for government to invest. The government uses its own money to do that.
What happens if the government invests money in bad ideas? Or invests too much money in good ideas? Well, the economy has a finite capacity to use money productively. When it is very active there is no capacity to take on new projects so the money will not be useful, it will be a nuisance and cause inflation. When the economy is not active, as in a recession, then the government can put a lot more money into the economy, because the economy has the capacity to do useful stuff with it. There is no problem of inflation. Getting these judgements right does require care.
But the wealthy already know about this. When we give them too much money, insane amounts of money, they have no idea how to spend it, so they pay higher and higher prices for prestige goods like yachts, houses and cars, simply spending too much in exchange for not very much really, in order to show off how rich they really are. Or they invest in so called Asset Bubbles - which get more and more expensive until the bubble bursts and the money is gone in a puff of smoke. Some rich idiots gets poor, but we help them to get rich again. The idea that giving more money to the rich will create jobs or anything else useful is a myth and the evidence shows it is not true.
That is not the end of the story but it is the end of my post.