Atmospheric CO2 comes from Volcanism.
It is released in Mid-Oceanic
Ridges (upwelling mantle) and in subduction zones. Early on, there
was much volcanism, thus a lot of CO2 was put into the
early Earth atmosphere.
CO2 is removed from the atmosphere via Photosynthesis from
plants, but the Ocean and carbonate sediments are the greatest
reservoir for CO2.
Moving back and forth between the Atmosphere
and in the form of Carbonates is controlled mostly by the current
temperature of the Earth.
This cycle has been going on since the beginning. If the Oceans are warm, the CO2 is more readily absorbed and precipitates out, removing it from the Atmosphere. However, if you reduce CO2, the earth cools due to reduced 'greenhouse' effect. Conversely, cool oceans absorb less CO2, which allows atmospheric levels of CO2 to increase and strengthen the greenhouse effect!
In this way, the oceans and volcanism kept the Earth at a very similar temperature, allowing for liquid water (not too hot, not too cool), even in the first billion years when the Sun was not as bright. Burning of fossil fuels has changed this balance in recent years, and may be leading to a heighten recent warming.