There are actually several ways that mountains are formed, and they all have to do with processes that take millions of years.
Many of the major mountain ranges are created when the Earth’s tectonic plates crash together. Because of the tremendous energies involved, the sides of the plates crumple like cars in a head-on collision. The mountain ranges are created because of those crumpling plates. The Indian subcontinent “crashed” into Asia 25 million years ago and created the Himalayan mountain range. In fact, the Himalayans are still growing!
The next way that mountains are formed is along fault lines. Blocks of Earth are uplifted and tilted over as two plates grind together. The uplifted part forms a mountain, and the lowered parts are filled in with eroded material. An example of this is the Sierra Nevada mountain range in California.
Another way that mountains are formed is when magma from beneath the Earth’s surface is pushed up, but doesn’t actually crack through. This bulge of magma eventually cools and hardens into hard rock, like granite. The layers of softer rock above the magma erode away and you’re left with a large dome-shaped mountain.
Of course, if the magma actually cracks through the surface, you get a volcano. Regular eruptions of lava, ash and rock build up a volcano to large heights. In fact, some of the largest, tallest mountains in the world are volcanoes. For example, Mauna Loa and Mauna Kea are examples of volcanoes. Measured from the bottom of the sea floor, they’re actually taller than Mount Everest.
The final way to form a mountain is through erosion. If you have a high plateau, rivers will carve deep channels into the area. Eventually, you have mountains in between the river valleys.