How does H2CO3 form when CO2 dissolves in water?

CO2 is a bit more soluble than other gases in air, because the oxygen ends of the molecule have a partial negative charge are better able to hydrogen-bond to the water as a result.

Waters first hydrogen-bond to the oxygen atoms on the ends of the CO2 and additional
The CO2 rather slowly acquires a shell of water molecules.
A fraction of these hydrated carbon dioxide molecules react with the water to produce carbonic acid (H2CO3):

CO2(aq) + H2O H2CO3(aq)

The equilibrium constant for this reaction is about 1.6×10-3 around room temperature, which means that most of the dissolved carbon dioxide is present as hydrated CO2.
Only about 0.16% of the dissolved CO2 is present as carbonic acid.

The activation energy for the reaction is rather high, since it involves bending a stable, linear CO2 molecule (with a water parked oxygen-down over the carbon) into a Y-shaped O=C(OH)2 molecule. As a result, the reaction proceeds very slowly.