In the past the atmosphere was mostly made up of water vapour. But as the earths temperature cooled the water vapour condensed and formed our oceans.
Volcanoes also contributed to the nitrogen in the atmosphere.
Plants then began to form. And as we know they photosynthesise. They take in co2 removing it from the atmosphere. And they release oxygen. Adding it to the atmosphere.
As rate of deforestation is increasing, we could see an increase in co2 levels in the atmosphere and also a decline of oxygen. This is because the plant is no longer cycling these elements.
However, humans naturally release co2 into the atmosphere through burning of fossil fuels etc.