There are three different kinds of rocks on Earth, and they form in very different ways. The first kind is igneous rock, which means “fire rocks”. Igneous rocks started out far underground, where it is very hot and they were melted. Then they shot out of a volcano as lava, and cooled back into rocks as they fell back down to earth, or after they landed. Granite is a common igneous rock.
The second kind of rock is sedimentary rock, or “sitting rock”. This is rock that was originally mud, or the shells of tiny sea creatures. The little bits of dust, or mud, or shells fall to the ground, or to the bottom of a pond or ocean, and get covered up by more layers of mud or shells. Eventually the pressure of all the stuff on top of them mashes them together into a hard rock. Limestone is a common sedimentary rock.
The third kind of rock is made out of the first two kinds. We call these metamorphic, or “changed” rocks. Metamorphic rocks are not as common as the first two. But sometimes an igneous or a sedimentary rock meets up with a lot of heat or pressure. This makes crystals form in the rocks, or, if the rock already has crystals, it can make bigger crystals. This turns the rock into a new kind of rock. A good example is carbon turning into diamonds.