Where are heavier element produced?
Most heavier elements are produced in stars.
Hydrogen was produced in the Big Bang,
Helium and Hydrogen isotopes were produced soon after the Big Bang. Main sequence stars fuse Hydrogen into Helium.
Lithium, Beryllium and Boron and created by cosmic rays. They can't be produced in stars except as intermediate steps in some fusion reactions.
Older stars fuse Helium into Carbon, Nitrogen and Oxygen.
Larger stars fuse heavier elements up to Iron.
Fusion reactions to produce elements heavier than Iron require more energy than is produced and so can't be created in stars. The elements heavier than Iron are produced by neutron capture during supernova explosions.