Global warming alarmists will emphasize that increasing or decreasing levels of CO2 (and other gasses with similar properties) will cause temperature to follow. Global warming denialists will emphasize that increasing or decreasing temperatures will cause CO2 levels to follow. Both observations are true. As the oceans are heated, they can hold less greenhouse gasses, and CO2 is released. CO2 does cause increased temperatures. Should the oceans cool, they can re-absorb the gas.
The result is positive feedback. If a movement in either temperature or CO2 concentrations starts, the other is pulled in, and they boost each other. A small shift in one becomes a somewhat larger shift in both... in either direction.
There are many factors that might cause a shift to start. Volcanic dust will cause cooling. Shifts in the Earth's orbit can allow more or less sunlight to effectively heat. The sun's intensity shifts in semi-predictable ways. Plants take CO2 out of the air, storing the carbon in biomass, oil, and coal. Such substances are burned, and released back into the atmosphere. Increasing levels of cosmic rays might ionize the atmosphere, encouraging cloud formation and thus reflecting light back into space. Continents drift, allowing or preventing the formation of polar ice caps. There are lots of things happening at vastly different time scales, many of which do not start with CO2 levels, but the feedback mechanisms tend to move CO2 levels regardless of the initiating mechanism.
If something that has nothing to do with greenhouse gasses is driving a temperature change, you will see the temperature curve move ahead of the CO2 curve. If a CO2 release is causing the temperature change, you will see the CO2 curve leading. Either way, if either curve moves, the other curve will tend to follow.
The time interval of the graph you show features ice ages coming and going.
Ice ages are caused primarily by the
Milankovitch Cycles, highly predictable changes in the orbit of the Earth. Thus, on the time scale of the above chart, the primary factor driving the changes is generally related to the amount and angle of arriving solar energy, not related to CO2 changes. Thus temperature generally leads greenhouse in that time scale and era.
The climate system is messy. One curve does not always lead, or always lag. The important thing to note is that the curves do follow one another. where either one goes, the other is apt to follow.