billion years the center of a star runs out of protons (nuclei of hydrogen atoms). What is left is a core or central region made of alphas (nuclei of helium atoms). The outer layers of the star still contain hydrogen, but they are not hot enough to fuse.
Because it has run out of fuel, the star begins to cool, and contract. The outer layers of the star fall inwards under gravity, and as they fall they heat up. A shell surrounding the central core becomes hot enough to fuse protons into alphas. So the star gains a new source of energy. The core of the star is now hotter than it was during its normal life and this heat causes the outer parts of the star to swell. The star becomes a giant. The radiation from the fusing shell has grown weak by the time it reaches the surface of the star. Weak radiation is red, so the star becomes a red giant.
Meanwhile inside the shell, the core of the star shrinks and heats up enough to fuse the helium nuclei together into even heavier ones. Among the commonest nuclei are carbon, nitrogen and oxygen. Heavier and heavier nuclei are created inside a red giant, the heaviest nearest the middle. At its center are iron nuclei.
These fusions release only a little more energy, so they keep the red giant burning for a little longer. But they do not produce as much energy as the fusion of protons. Iron nuclei cannot be used as fuel because they need to be given energy to make them fuse. So iron nuclei collect in the heart of a red giant star.
The Sun will run out of fuel and become a red giant in about 4 billion years. What do you think will happen to the Earth then? Click here for the answer.