Stars are born in nebulae, vast clouds of dust and gas in space. Some of the gas in a nebula is hydrogen gas. Over millions of years, gravity causes the hydrogen gas to collect in a cloud. As more and more gas is pulled into the cloud, it begins to spin. As the cloud spins, atoms of hydrogen gas bump into one another. The faster the gas spins, the more the atoms bump together. The temperature of the spinning cloud rises.
When the temperature reaches ten million degrees Celsius, a chemical change called nuclear fusion begins to take place. In this change, two atoms of hydrogen gas combine to form an atom of helium gas. The gas in the nebula begins to glow. This is the first step in the life cycle of a star. It is called a protostar. This chemical change gives off a large amount of energy in the form of heat. This causes the nebula to break up into a cluster of many baby stars. The new stars give off heat and light from the nuclear fusion of hydrogen atoms.
After a star forms, it is in its main life period called the main sequence period. A main sequence star lives and shines fairly steadily for millions of years or more. Stars with greater mass have hotter temperatures and usually shorter lives. When the star's supply of hydrogen is used up, it begins to convert helium into oxygen and carbon. If the star is massive enough, it will continue until it converts carbon and oxygen into neon, sodium, magnesium, sulfur, and silicon. Eventually, these elements are transformed into calcium, iron, nickel, chromium, copper, and others until iron is formed.