Apart from trace quantities of lithium and beryllium, the only elements present in the Universe immediately after the Big Bang were hydrogen and helium. The remainder of the chemical elements (what astronomers refer to as metals) have since been produced by nuclear reactions in stars.
Although stars produce metals in their cores throughout their lifetimes, only a small fraction of these metals escape during this period (through stellar winds or thermal pulsations) to be incorporated into new stars. Instead, most of the metals we observe in the Universe have been produced and scattered by the titanic explosions that mark the end for many stars - supernova explosions.
Modern research has shown that different elements are produced by the different types of supernova. A Type II supernova (the explosion of a massive star) will produce mainly light metals such as carbon and oxygen. In contrast, a Type Ia supernova (the explosion of a white dwarf star in a binary system) will produce mainly heavy metals such as iron and nickel.
The different sites for the production of heavy and light elements has an important implication for research into galaxy formation. This is because Type II and Type Ia supernovae occur at very different times in the history of the galaxy.
The different timescales for the production of light and heavy elements means that galaxies which form on short timescales (for example, by primordial collapse) will have high abundance ratios of light to heavy elements. In contrast, galaxies which form on longer timescales (perhaps by mergers or secular evolution), will have much a higher heavy element content, and lower light-to-heavy element abundance ratios. Measurements of these abundance ratios are just beginning to allow astronomers to probe the timescales on which galaxies form.