Stars leave the main sequence when they
have fused all the hydrogen in their cores.
Various things can happen subsequently
to that star as it becomes a
post-main sequence star, including
fusing heavier elements in the star's core.
Bennett et al.
Even higher pressures and temperatures are
required to create heavier elements
(remember that we have talked about how and
where heavy elements are made.).