Why do red giants form?
When a star uses up all the hydrogen in it's core it enters the red giant phase.
When all the hydrogen in the core of a star is fused to form helium it starts to contract. As that happens more hydrogen comes into the area where the core originally was.
Now this outer shell of hydrogen starts fusing into helium and the star becomes very bright and also very big. Since the energy production remains almost the same but is now spread over a larger area, the star cools in the red giant phase.
When all the hydrogen in the outer shell is also consumed it enters the next phase of it's life in which only the core survives and the outer layers are discarded. The mode of achieving this is different for different stars.