Once the Sun changes from burning hydrogen at its core to burning hydrogen around its shell, the core will start to contract and the outer envelope will expand. The total luminosity will steadily increase over the following billion years until it reaches 2,730 times the Sun's current luminosity at the age of 12.167 billion years. Most of Earth's atmosphere will be lost to space and its surface will consist of a lava ocean with floating continents of metals and metal oxides as well as icebergs of refractory materials, with its surface temperature reaching more than 2,400 K (2,130 °C; 3,860 °F). The Sun will experience more rapid mass loss, with about 33% of its total mass shed with the solar wind. The loss of mass will mean that the orbits of the planets will expand. The orbital distance of the Earth will increase to at most 150% of its current value.
The most rapid part of the Sun's expansion into a red giant will occur during the final stages, when the Sun will be about 12 billion years old. It is likely to expand to swallow both Mercury and Venus, reaching a maximum radius of 1.2 AU (180,000,000 km). The Earth will interact tidally with the Sun's outer atmosphere, which would serve to decrease Earth's orbital radius. Drag from the chromosphere of the Sun would also reduce the Earth's orbit. These effects will act to counterbalance the effect of mass loss by the Sun, and the Earth will probably be engulfed by the Sun.
The drag from the solar atmosphere may cause the orbit of the Moon to decay. Once the orbit of the Moon closes to a distance of 18,470 km (11,480 mi), it will cross the Earth's Roche limit. This means that tidal interaction with the Earth would break apart the Moon, turning it into a ring system. Most of the orbiting ring will then begin to decay, and the debris will impact the Earth. Hence, even if the Earth is not swallowed up by the Sun, the planet may be left moonless. The ablation and vaporization caused by its fall on a decaying trajectory towards the Sun may remove Earth's crust and mantle, then finally destroy it after at most 200 years. Following this event, Earth's sole legacy will be a very slight increase (0.01%) of the solar metallicity.
Alternatively, should the Earth survive being engulfed to the Sun, the ablation and vaporization mentioned before may strip both its crust and mantle leaving just its core.
Explanation from: https://en.wikipedia.org/wiki/Future_of_Earth#Solar_evolution