The difference is the initial masses of each star and the masses of the cores of each star while they are on the Herzsprung Russel main sequence and are in hydrostatic equilibrium between gravity acting inward and PRESSURE. When a star becomes a red star or a supergiant red star it is because the force of pressure outward is greater than gravity acting inward toward the core.
When the star runs out of hydrogen in the core, there a helium flash in the layer of hydrogen surrounding the core when the hydrogen tries to fuse I to helium because the pressure is high enough in the hydrogen layer to trigger the helium flash. In low mass star like the Sun the helium flash makes conductive and convective layers explode outward , creating the planetary nebula. The core of the low mass star does collapse some, but it NOT keep collapsing because if degeneracy pressure. The core becomes a white dwarf star where no nuclear fusion is occurring, but the core is still radiating as it cools off.
In a high mass star, Other fusion processes occur in the layer surrounding the stars' core fusing hydrogen into him, helium into carbon, carbon into oxygen,magnesium, calcium silicon and ultimately iron. Then the massive star goes super nova. The conductive and convective layers explode outward while the core collapses to become a neutron star or a black hole with an event horizon.