How was the planet Earth formed?
Chunks of rock and frozen liquids in orbit around the newly forming Sun converged and melted together to form the planets. Each time a planetisimal (see the Introduction) hit the rotating chunk of material that was to become Earth it melted in to the existing mass. The mass was hot and the metals were molten so the heavy metals like iron sank toward the center of the mass while lighter metals like silicon floated near the surface.