We report on ab initio molecular dynamics simulations of the early stages of single-walled carbon nanotube (SWCNT) growth on metal nanoparticles. Our results show that a sp2 bonded cap is formed on an iron catalyst, following the diffusion of C atoms from hydrocarbon precursors on the nanoparticle surface. The weak adhesion between the cap and iron enables the graphene sheet to "float" on the curved surface, as additional C atoms covalently bonded to the catalyst "hold" the tube walls. Hence the SWCNT grows capped. At the nanoscale, we did not observe any tendency of C atoms to penetrate inside the catalyst, consistent with total energy calculations showing that alloying of Fe and C is very unlikely for 1 nm particles. Root growth was observed on Fe but not on Au, consistent with experiment.