A tallest plant in the neighbourhood gets the most of the sun energy. 350 m. years ago on a race to outgrow each other, some of plants evolved to trees.
As plants became bigger and taller they started to absorb more CO2 and release O2 as a waste product. Their secret to a strong trunk was an emergence of a lignin molecule in it’s structure.
At that time there was no organisms to eat tough fallen trees’ trunk. So they kept obsorbing CO2 and producing O2 as their carbon rich dead bodies sank in swamps.
Buried trees took large portion of CO2. It greatly reduced greenhouse effect of the Earth’s atmosphere, which led to what’s now known as the Karoo Ice Age.
As millennias passed, buried ancient tree material slowly decomposed and was pressed to form coal.
Just before the great dying one of the largest known volcanic events occurred in Siberia. It released a lot of carbon by burning local coal. It was probably the main factor to the biggest extinction event ever, killing 9/10 species on planet. After Permian extinction CO2 levels stabilized to a similar levels as it is now.
Ever since the Industrial revolution in 19th century, humanity keeps burning coal and returning this ancient carbon to the atmosphere.