As the earth cooled, there was no atmosphere to trap the heat. The surface cooled off fast due to the cold temperature of space (like how the top of coffee cools off when exposed to the air). This created a layer of cooled rock that solidified into the crust. Differences in magma created two types of the lithosphere, oceanic and continental, characterized by the basalt in oceans and granite in the continents.
The lithosphere changes its depth. Underneath continents, the lithosphere is deepest and the roots of mountain ranges go down tens of miles (like an iceberg, there is more underneath). The compositions of each type of crust change at plate boundaries, where new rocks are formed from common minerals in both crusts or one is metamorphosed into other rocks. Oceanic lithosphere becomes very dense due to eclogite near subduction zones and so it plunges below the light continental crust into the mantle.
Hope it helps. Cheers. All the best. :)