You confused two things. There is the Sun turning into red giant in 5 billion years consuming the Earth, and the Sun getting too bright for Earth to be habitable in 500 million years.