One way is the intrusion by hot magma. This kind of metamorphism is called contact metamorphism. Another important way to get heat is deep burial. Gradual burial in a sedimentary basin can bury rocks formed at the surface to several kilometers. An increase in pressure reduces mineral space and drive chemical reactions that produced new minerals with closer atomic packing and higher density.
Pressure increases with depth inside solid earth much like pressure increases with depth in water.
In this case, metamorphism can occur over large areas and is called regional metamorphism. Regional metamorphism also occurs during mountain building when great volume of rocks are subjected to directed stress. The greatest volume of metamorphic rocks are best exposed in the deformed mountain belts and in ancient stable continental interiors known as shields, such as the Canadian Shield. Shields are assumed to be the remnants of ancient periods of mountain building. Contact metamorphism and regional metamorphism are the two main processes of metamorphisms.