After the Big Bang, the universe was made up of the two lightest elements: hydrogen and some helium. Nucleosynthesis was responsible for creating heavier elements; young stars form helium out of hydrogen.
In the later stages of a massive star's life, helium is converted into heavier elements like carbon, oxygen, silicon, and iron. When a star goes supernova, they create elements heavier than iron. Elements with even atomic numbers are an order of magnitude more common than odd ones. Read more