Most of the solid Earth consists of just a handful of different elements. The hot core, about 5,600 kilometres across, is mostly iron. Surrounding this is the mantle and atop the mantle is the crust. The Earth was created when large rocky blobs called planetesimals collided and coalesced in the early Solar System. The energy released by these impacts left most, perhaps all, of the planet molten, whereupon the rocky magma separated from the molten iron.
Some elements are more soluble in iron than in magma.
These are called 'siderophiles', meaning iron-loving, and they are thought to have segregated to the Earth's core when the world was a young fiery ball. Because of this, the mantle is low in siderophile elements. This becomes clear if we compare the chemical composition of the mantle with those of a certain kind of meteorite called chondrites. Chondrites are almost as old as the Earth. They are thought to be left-over lumps of the planetesimals from which the planets formed.