The Biggest Stars Get Huge Only When They Start to Die
Once a star burns through its hydrogen, its core tightens and its outer layers balloon, and the most massive dying stars are basically blowing themselves apart.

Kurzgesagt – In a Nutshell · The Largest Star in the Universe – Size ComparisonThe biggest stars are the ones that are dying.
Most stars spend their lives turning hydrogen into helium deep inside, giving off enormous amounts of energy. Heavier ones burn hotter and brighter for shorter times. After that hydrogen burning phase ends, they can grow to several hundred thousand times the size they started at. That bloated phase lasts only a small part of their lives, so a ranking of star sizes mixes stars at very different ages.
Size does not come from packing on extra weight. It comes after the core fuel runs low.
When a star uses up the hydrogen in its core, the core contracts and becomes hotter and denser. The added heat speeds up fusion, and the extra energy inflates the outer layers. Gacrux, only 30% more massive than the Sun, has swollen to about 84 times the Sun's radius. Late in its life, the Sun is expected to expand to 200 times its current radius, engulfing the inner planets.
The largest known stars are red hypergiants, the swollen late phase of the heaviest stars. They may be the largest stars even possible, but the exact record holder is uncertain because these distant and windy giants are hard to measure. Their surfaces are so extended that gravity there is too weak to hold hot material in place, so they are basically blowing themselves apart, losing gas in powerful stellar winds.
Questions people ask
Do all stars become giants when they die?
Red dwarfs, the smallest true stars, burn so slowly that they can last up to 10 trillion years. Instead of swelling into giants, they are expected to simply cool and fizzle out, because their structure does not produce the same core contraction and outer swelling.
What will happen to our solar system when the Sun swells up?
In about five billion years the Sun will exhaust its core hydrogen and expand to about 200 times its present size. Mercury, Venus, and likely Earth will be engulfed, while the outer planets will survive around a much brighter, redder Sun before it shrinks into a dense remnant.
Where does all the material blown away by hypergiants go?
Hypergiants shed huge amounts of gas because gravity at their puffed-up surfaces is too weak to hold hot material down. Those winds enrich space with heavier elements, which later become incorporated into new stars, planets, and living things.