How does a star's temperature change as the star ages from a main sequence star to a red giant and from a red giant to a white dwarf?
In the core of a main sequence Star temperature and pressure is high enough to undergo hydrogen fusion but it is still not enough to fuse the helium that is building up in the core. When the Sun runs out of hydrogen its core will rearrange itself and the outer layers will expand due to the energy coming out of helium fusion this will lower the temperature of the Sun causing it to give of light in the redder portion of the visible spectrum, hence the name Red Giant, although it will first burn a layer of additional hydrogen surrounding the core to begin the Red Giant Stage. The size of the Sun in the main sequence stage is about 0.2 AU. The size of the Sun as a Red Giant is about 2 AU, now you can imagine what energy Helium fusion can give off to maintain that size.
The temperature inside the core of a Red Giant Star is still building up until it is ready to fuse Helium into carbon and other heavier elements. But the Sun will never be hot enough to burn carbon and so this time the inward acting gravity will win as there will be more pressure to balance that gravity.
At this point the sun's outer layers will blow off and what's left is only the core also known as a White Dwarf. The pressure inside the core has vastly increased and so has it's temperature due to the intense gravity.