Our Sun is a middle-aged star fusing hydrogen in its core into heavier and denser helium. As the Sun ages, the helium builds up, eventually leaving no hydrogen fuel. The fusion of hydrogen generates energy that counteracts gravity, so in about 5 billion years the Sun's core will start to collapse. It will heat up, with the remaining fusion reaction taking place at a faster rate in a shell of hydrogen gas surrounding the core. The extra energy produced will push the outer layers of the Sun outward; they will cool and take on a reddish hue. The Sun will engulf the current orbits of Mercury, Venus, Earth, and perhaps even Mars as it becomes a red giant star. A strong stellar wind will result in large mass loss for the Sun as it blows away its outer layers.
Eventually it will get hot enough for the helium in the core to undergo fusion reactions, creating carbon and oxygen. Thus a new fuel source will stabilize the future Sun and shrink its size. Eventually, this source will also be exhausted and the core will once again start to collapse and heat up, with increasing reaction rates leading to another phase of growth and increased stellar wind. Unlike the previous phase, the Sun will not be able to squeeze the carbon/oxygen core tight enough to initiate new fusion reactions. So with the eventual loss of its outer layers, the remaining core will become a carbon/oxygen white dwarf star surrounded by remnants of its original outer layers, a planetary nebula.
The graphic shown here is only the simplest model of what will happen. The reality is that the reactions inside the Sun become increasingly complex and the size variations are difficult to model exactly. During its death throes, the complex reactions inside the Sun, via slow neutron capture events (s-process) leads to increasingly complex chemistry and nucleosynthesis. The core undergoes thermal pulses and the mass loss varies with increased stellar winds. All these complexities make the study of red giant stars one of the most interesting topics of study in astronomy.