Q:

What will happen to the earth when the sun becomes a red giant

Answer

The Sun will become sufficiently large to engulf the current orbits of the solar system's inner planets, including Earth.