A geyser is really a hole in the ground that is filled with hot water. There is a tube that leads from the surface to underground reservoirs which serve as storage basins for the water.
Most of the water comes from rain and snow.
Deeper in the Earth the rock is very hot. Gases from these hot rocks, mostly steam, rise through cracks in the rock and reach the underground reservoirs. They heat the water there to above-boiling temperature.
If the steam and water can rise freely from below, the result is a steadily-boiling hot spring.
However, because the passageway from the water is not straight, the geyser erupts as the trapped water suddenly turns to steam.
Steam requires more room than water, so it pushes up the column of water above it. Instead of just an overflow at the surface, there is a violent eruption as a result of the steam bursting upward. This produces the spectacle of a geyser!