What is the main cause of stagflation?
Historically, the main cause of stagflation has been supply shocks. To see why this is so, think about a graph that shows aggregate supply and aggregate demand. The x axis is the Real GDP and the y axis is the CPI.
A supply shock happens when something affects the economy to make aggregate supply decrease sharply. This can be something like a war that leads to an increase in the price of oil (since oil is an input in practically every good and service). When supply decreases, the AS curve moves to the left. This causes the price level to increase (inflation) and Real GDP to decline (stagnation).
So, the main cause of stagflation is a supply shock such as an increase in the price of oil.