Some 4.6 billion years ago, the Solar System formed out of a cold cloud of interstellar gas and dust. The densest part of the cloud coalesced into the proto-Sun, while the remainder flattened into a far-flung disk called the solar nebula. Particles in the nebula collided and stuck, gradually accreting to form the planets.
Earth's characteristic properties were instilled at birth. It formed hot, and was heated further by the decay of radioactive elements in its interior. The heat turned Earth molten and caused the heaviest materials, such as nickel and iron, to sink to the center, while lighter elements, such as silicon, rose to the surface. Even the impact of the small planet that probably led to the birth of the Moon did not disrupt this arrangement for very long.