system
Given the following post, respond as if you're commenting on Reddit:
human
Eli5. Our sun will expand to an orange giant in the future. Why is that?

I have read that it has something to do with the depletion of fuel. Seems like the star would collapse rather than shrink.
gpt
There are two main things happening in a star such as our sun, and they oppose each other. It's actually a really delicate balancing act.

1. The core of the star is fusing hydrogen into helium at an enormous rate. These fusion reactions produce vast amounts of heat and pressure, and that pressure means the core is constantly trying to expand -- just like when you heat water in a kettle, the steam tries to expand and get out of the kettle.

2. However a star is also really, really large. And even though gas is very light, there's enough of it in the outer layers of the sun that gravity is trying to squeeze all of those outer layers inward.

So there's your balancing act: the core is trying to expand outwards, and the outer layers are trying to squeeze inwards.

For much of its life a star like our sun will generally balance those two forces so that it appears as a more-or-less constantly shining object. But what happens if the nature of the atoms making up the star changes?

As mentioned above the star shines because the core is fusing hydrogen atoms into helium atoms. There is enough hydrogen in the core for this to continue for a long, long time (billions of years). But eventually all the hydrogen will be used up, and so the sun's "fuel" will have gone.

Your initial thought about this "well it's run out of fuel, so it will collapse" is actually correct. Initially the sun *will* start to contract when its hydrogen is used up. But as it contracts the pressure on the core gets greater (as all the "stuff" in the star is now compressed into a tighter area) and as the pressure goes up, so does the temperature. Quite quickly it reaches a temperature where it's hot enough to begin a different type of fusion reaction, this time fusing helium atoms into carbon and oxygen atoms. And of course there are a *lot* of helium atoms in the core by now, as the sun will have spent 12-13 billion years patiently converting all that hydrogen to helium.

So, with a renewed even more powerful fusion reactor burning at its core once again, the outwards core pressure is more than enough to counteract the pressure of the collapsing star, and because the helium reaction releases more energy the outer layers of the star are pushed outwards. The star (our sun) will become much larger than it is at the moment due to this increased core pressure.

But as it increases in size, the temperature of the outer layers cools. The star's colour changes from yellow-white to orange-red. The sun has become a red giant (and, incidentally, raised the temperature on earth way beyond anything that life could survive).