Answer: The different layers are a result of lighter parts (such as the continental crust) settling at the surface level and heavier parts (such as iron and nickel in the core) settling in the middle. The layers separate by density, otherwise known as compositional layering. The earth did not always have these layers, as it had to undergo cooling to form some of them (like the continental crust).