A closer look at Asymptotic giant branch
A low- or intermediate-mass star can reach a late giant phase with burning shells around an inert carbon–oxygen core.
Pulsation, strong winds, and episodes of shell burning can change the surface chemistry and shed the envelope. A white dwarf is the exposed compact remnant of a star that has shed its outer layers.
Dusty red stars seen brightly in infrared can be losing material that will later enrich the interstellar medium.
OpenStax · Astronomy 2e · 22.4 Further Evolution of Stars · Asymptotic giant branch stars – progenitors of planetary nebulae
Want to learn more about Asymptotic giant branch? Asymptotic giant branch on Wikipedia.

