Then what, pray tell, do you imagine causes stars to explode? Gravity only pulls inward after all...
Most stars are mostly hydrogen and helium, right up until their final days. Truly massive ones may indeed build up substantial reserves of heavier elements in absolute terms, but the heavier, stabler ones, especially iron, tend to settle into the core and remain there, stable and "dead", until enough accumulates to exceed the Chandrasekhar limit (about 1.4 solar masses, less than 1% of a large star's mass) at which point gravity overcomes the electron degeneracy pressure and the core collapses to become a neutron star or black hole.
At that point my understanding gets sketchy, but as I understand it the sudden heating and compression of the remaining mass triggers a runaway fusion reaction, further superheating the infalling material to the point that even energy-negative fusion occurs, generating the myriad elements beyond iron, and of course blowing apart the star as the blast wave nears the surface.
At a smaller scale, type 1a supernovae are a somewhat different mechanism - believed to occur when a white dwarf (a dead star remnant consisting primarily of carbon and oxygen, without enough mass to fuse all the way to iron) accretes enough matter from a companion star that it's mass exceeds the electron degeneracy pressure, and it begins to collapse again. But before collapsing all the way to a neutron star, runaway carbon fusion reaction begins, releasing over the course of days more energy than it did in the rest of its lifetime, and tearing itself apart in the process.
Thanks for the motive to research this a little more thoroughly. Wikipedia has some very interesting pages on stellar physics, and I rarely have an excuse to read them.