How were the materials that make up the earth come into being?
They were made in stars
Well.. sort of.
In the beginning there was the Big Bang and mostly plasma. Then, there was hydrogen, helium and traces of lithium. Then, due to irregularities in density and heat, the molecules slowly clumped.
Eventually elements formed in stars through nuclear fusion. I think that all elements from iron (Fe) and up were formed in stars.