Aggregate demand is everything spent on the economy's output: C + I + G + (X − M). The budget pulls on it from two sides. Government spending on goods and services lands in G whole, but a tax change only reaches AD through the part of disposable income that households go on to spend. Raise government spending by $40B, then put it back and raise the tax take by $40B instead, and watch how far the aggregate demand bar moves each time.
Government spending on goods and services is the G in aggregate demand, so a rise in G lifts AD by the same amount in the first round: $40B of extra spending on hospitals, schools and roads is $40B of new demand for Australian output. The bar shows that first round only. Later rounds, when the nurses, builders and suppliers who receive the money spend their new incomes, add to it through the multiplier. The spending also reallocates resources, pulling workers and capital into the industries the budget funds, which matters most when the economy is near full employment and those resources must come from somewhere else. Reverse the change and G falls, which is how a contractionary budget cools demand.