When a star exhausts hydrogen in its core, fusion there stops. Gravity causes the core to contract, heating it further. Meanwhile, hydrogen fusion continues in a shell around the core, releasing even more energy.
This extra energy pushes the outer layers outward, causing the star to swell dramatically. The surface cools as it expands, giving the star a reddish color.
This red giant phase marks the beginning of the end for a star. What happens next depends heavily on the star’s mass.