Final answer:
The heavier elements in planets come from the debris of supernova explosions that occurred before the solar system was formed.
Step-by-step explanation:
The elements heavier than hydrogen and helium of which the planets are composed probably came from the debris of supernova explosions that occurred before the solar system came into being. These supernova explosions are the result of massive stars reaching the end of their lives and undergoing a powerful explosion. During these explosions, heavier elements are synthesized and scattered into space, eventually becoming part of the material from which planets are formed.