Big bang nucleosynthesis refers to the process of element production during the early phases of the universe, shortly after the Big Bang. It is believed to be responsible for the formation of hydrogen, its isotope deuterium, helium in its varieties 3He and 4He, and the isotope of lithium 7Li. Hydrogen nuclei (protons) are believed to have formed as soon as the temperature had dropped enough to make the existence of free quarks impossible, but for a while the number of protons and neutrons was almost the same, until the temperature dropped enough to make its slight mass difference favor the protons. Isolated neutrons are not stable, so the ones that survived are the ones that could bond with protons to form deuterium, helium, and lithium.
Why didn't all the neutrons bond with protons and make all elements up to iron? While the temperature was dropping, the universe was also expanding, and the chances of collision were getting smaller. Also very important is the fact that there is no stable nucleus with 8 nucleons. So there was a bottleneck in the nucleosynthesis that stopped the process there. In stars, the bottleneck is passed by triple collisions of 4He nuclei (the triple-alpha process). However the triple alpha process takes tens of thousands of years to convert a significant amount of helium to carbon, and therefore was unable to convert any significant amount of helium in the minutes after the big bang.
Using the Big Bang model, it is possible to make predictions about elemental abundances and to explain some observations which would otherwise be difficult to account for. One such observation is the existence of deuterium. Deuterium is easily destroyed by stars, and there is no known natural process which would produce significant amounts of deuterium. Another observation is the existence of far more helium in old stars that can be accounted for by stellar nucleosynthesis.
The relative abundances of the different elements produced are dependent on the number of photons per baryon. As the number of photons is dominated by the cosmic microwave background radiation, measuring the primordial abundances of those elements allow us to know the density of baryons, that is, of matter in the universe.
See also: Ultimate fate of the Universe