The carbon cycle is the way carbon is stored and replaced on Earth. Some of the main events take hundreds of millions of years, others happen annually.
The main ways that carbon gets into the carbon cycle are volcanoes, and the burning of fossil fuels like coal and gas. Through most of history, volcanoes were the biggest source of carbon to the carbon cycle, but in the last hundred years, people burning fossil fuels have been adding about a hundred times more CO2 to the air than volcanoes. That is, for every ton of CO2 added to the air by volcanoes, about 100 tons of CO2 have been added to the air by people through combustion.
The main way carbon gets taken out of the atmosphere is by photosynthesis by living organisms. Some of this gets released as they die and decompose, but a proportion gets buried in sediment. This is shown in the diagram. Sediment turns to rock, and it is the carbonate rocks like limestone which contain the now-solid CO2. Some of the carbon from plants also becomes part of the soil, where it can stay for a long time before decomposing.
Another process takes CO2 out of the air. Weathering by rain washes out CO2 in the form of dilute carbonic acid. This reacts with rock, helping to dissolve and destroy it. This also ends up as sediment.
Some CO2 is also dissolved in the ocean. Right now, the oceans are taking in more CO2 than they are releasing, every year. However, this is making the oceans more acidic.
The store of carbon in sedimentary rock is far greater than the CO2 in the atmosphere (this is not shown in the diagram). Eventually it returns to the air as oceanic plates subduct in tectonic plates. At the margins of plate boundaries (and some other places) volcanoes form and spew out CO2. This completes the cycle.