Once the core of fuel runs out it starts burning the ash(helium) that produces more heat so a small sphere of hydrogen gets heated above fusion temperatures that produces pressure so the sun expands, this little sphere again runs out of fuel and increased temperature that again heats a new large sphere and so on.
This is a gradual process, in the case of our sun about [2 billion years](https://en.wikipedia.org/wiki/Formation_and_evolution_of_the_Solar_System#Timeline_of_Solar_System_evolution)
Latest Answers