Trees are batteries that store carbon. The carbon is restored into the atmosphere when a tree dies and decays, or is burnt.
A long time ago trees didn't decay because the Earth didn't have "fungus" that made them rot and decay. So they just piled on top of each other and turned into coal.
Plant more trees. https://onetreeplanted.org/