How does a red giant become a white dwarf?
A red giant becomes a white dwarf when it runs out of fusable material.
When a star of less than about 8 solar masses runs out of hydrogen in its core, the mainly helium core collapses and heats up. When it gets hot enough fusion reactions start in the layer of hydrogen surrounding the core. This causes the outer layers of the star to expand into a red giant.
When the collapsing core gets hot enough, helium fusion starts taking place. At this stage the star is no longer a red giant.
When the supply of helium is exhausted, the core is mainly carbon and oxygen. The star isn't big enough for the core to get hot enough to start carbon fusion. The star is now a white dwarf.