The early baryonic universe consisted of 72% hydrogen, 27% of helium and tiny traces of deuterium and lithium.
Temperatures from the original big bang were insufficient to cook up any of the heavier elements. Carbon and the other heavy elements would be forged later in high energy explosions of certain dying stars.
About one billion years after the Big Bang, the first galaxies and the stars they contain were formed. Slowly at first, the hydrogen/helium gas, plasma and dust clouds pulled in more and more material and collapsed under their own ever-increasing internal gravity.