As the early Earth atmosphere cannot be measured directly today, clues need to be found from within the Earth's crust. This includes the chemical make-up of rocks, examining air bubbles in ice cores and looking at fossils.
The very early atmosphere would have been mostly carbon dioxide gas, with smaller amounts of water vapour, ammonia gas and methane gas. These would have been formed from all the volcanic activity on the red hot planet. It is thought the atmosphere of Venus today is similar to what Earth's atmosphere would have been like.
As the Earth cooled down, the water vapour condensed into liquid water which started to collect and form streams, lakes, oceans, etc. Further water was delivered to the planet from collisions from comets.
This liquid water started dissolving carbon dioxide gas from the air. The earliest types of plant life in the ocean then began to form and so photosynthesis began! The photosynthesis further took in carbon dioxide from the atmosphere, lowering the levels further, but oxygen started to be given out as a by-product!
This oxygen that was released could then remove the ammonia and methane from the atmosphere by reacting with them.
Once the oxygen levels started rising, more complex life forms could form and plant life also began to become increasingly complex.
Special bacteria in the ground, called denitrifying bacteria, started to breakdown other chemicals and produce vast quantities of nitrogen gas which was then released into the atmosphere!
Other than photosynthesis and dissolving in the oceans, carbon dioxide also became locked up in sedimentary rocks such as limestone and in fossil fuels such as crude oil and coal.