If government spending and GDP both grew significantly over the last few years then there is a positive correlation between them. And you’d be tempted to say that the rise in government spending caused the increase in GDP.
However, correlation does not imply causality. Just because government spending and GDP both increased, it doesn’t mean one caused the other, there may be no causality at all.
For instance, maybe GDP rose before government spending, meaning GDP growth caused the rise in government spending as the higher national output gave the government more tax revenue to spend. Or, maybe GDP growth encouraged the government to start spending more because they thought the economy was getting back on track.
Even if government spending was rising before GDP, we may still find it difficult to draw a line of causality from government spending to GDP. For instance, maybe another variable caused the rise in government spending and GDP. Perhaps private investment rose over the same period, boosting GDP and encouraging the government to spend more.
Alternatively, there may be correlation without any factors causing any causality at all. Consider spurious (or nonsense) correlations. Believe it or not, between 1999-2009 there is actually a correlation between the number of people who drowned in a swimming pool in the USA and the number of Nicholas Cage movies. There is no direct or indirect relationship between these 2 variables, so it doesn’t make any sense to say one caused the other or vice versa.
The point is, as an economist, don’t just look at correlation to determine causality, look at the bigger picture, look at other factors. Maybe there is no causality to draw. Looking at alternative factors that cause correlations is a good way to evaluate. For example, you could explain that higher government spending caused GDP to rise but evaluate by arguing how both increased mostly due to a rise in expectations about the economy.