Each of the rock types is related to the others through different physical and chemical processes.
Mountains can expose igneous, sedimentary, and metamorphic rocks to weathering and erosion.
Grains of sediment (or boulders!) break off of these exposed rocks, and, due to gravity, move downhill either in a stream bed or by rolling. This travel causes further breakdown of the sediment, which eventually reaches the ocean. The sediment, once deposited in an ocean basin, gets buried by other sediment, and compacted into a sedimentary rock. If it’s buried deep enough, or if the basin becomes part of an orogen, it can be metamorphosed, becoming a metamorphic rock.
Eventually, the rock can either become exposed through sea level fall or mountain-building, where it starts the journey back to the ocean again, or it can be recycled back into the mantle at a subduction zone, perhaps one day returning to the surface as an igneous rock.
The following concept map shows the rock cycle in terms of earth processes. New material comes from mid-ocean ridges and volcanoes; it is weathered, deformed, compacted and cemented, until it is recycled back into the mantle at a subduction zone.