I think you will find the answer to this question in every better textbook of hydrochemistry. The balance between CO3-2, HCO3- and CO2 is determined primarily by the current value of the acid-base reaction and the buffering capacity of the system.
Following on from Dalibor Matýsek above, atmospheric CO2(g) will contribute to the CO3-2, HCO3- and CO2 equilibrium system in rainfall which then recharges to groundwater. This is in addition to the dissolution of bi/carbonate containing minerals in the soils/rocks that groundwater comes into contact with.