government spending affect aggregate demand?
The use of government spending to affect aggregate demand is one of the cornerstones of macroeconomic policy, and it is referred to as fiscal policy. Technically speaking, tax cuts/increases can also be used for a similar purpose, but direct government spending manipulation is usually the preferred method of enacting fiscal policy.
The reason for this preference is that increases/decreases in spending will have an immediate impact on the economy whereas tax changes may, to some extent, lead to changes in saving rates rather than spending rates. If that were to happen, the fiscal policy action would be somewhat reduced in effectiveness.
Consider the aggregate demand function, Y = C + I + G + (X – M)
The 'G' in this function stands for net government spending and, for obvious reasons, it is a much easier component for the government to fully manipulate as desired.
I should note that in normal times, i.e. times when the economy is not in a liquidity trap with near zero interest rates regardless of money-supply manipulation, fiscal policy is not usually the preferred economic stabilization tool in times of need. Monetary policy is usually the first line of defense, but when that runs out of steam we tend to see more fiscal actions by the government to try and steady the economic ship.
Monetary policy is usually controlled by central banks rather than governments, but again this only really applies during normal times. There is a great deal of speculation at the current time as to just how independent these central banks really are, and to what extent they are influenced by government officials.
Regardless of the true nature of central bank independence, fiscal policy has surfaced in recent times as the most important policy tool for controlling the economy. That means that the level of government spending via stimulus packages, infrastructure investment, welfare support, and so on, is the main instrument of macroeconomic management.
There are of course, no policy tools that can maintain disequilibrium in an economy indefinitely, and I'll leave it to the reader to decide whether or not they regard the size of national debt levels throughout the western world, and the enormous trade deficits, and the enormous budget deficits, and the fact that our debtors are starting to refuse to lend more money to us, and the fact that we are printing money at insane levels at a time of growing inflationary pressure, whether any of this makes any sense and whether it is sustainable.