Economist John Maynard Keynes spearheaded a revolution in economic thought. His argument overturned the idea prevailing at the time, namely that the free market would always automatically bring the economy into full employment.
The great depression that occurred in the 1930s proved that the free market argument was wrong. The economic slowdown turned out to be long-lasting and there were no signs of recovery.
Keynes then emerged and argued that a stimulus was needed to get out of the great depression. Keynes further stressed that free markets do not have a mechanism of self equilibrium that leads to full employment.
He sees aggregate demand as the most important driving force in an economy. So, to drive the economy, aggregate demand should be stimulated to grow. In this case, the role of government is needed to stimulate aggregate demand.