Hot springs can exist where hot liquid rock is trapped inside solid rock, deep underground. But two special things are needed before a hot spring can become a geyser: (1) underground cavities in which water can collect; and (2) a narrow tube leading from the cavities up to the surface.
Here is how a geyser works. Water collects in the cavities. Heat from the liquid rock far below reaches this water and makes it boiling hot. But it can't behave the way ordinary boiling water behaves in a pan on the stove. In the pan, boiling hot water turns to steam; the steam rises from the bottom, and flies off into the air. But the hot water in the geyser cavity can't escape so easily. Remember, there is only a long narrow tube leading to the air outside. The cold water in it acts somewhat like a huge cork in a bottle. The steam can't escape because of the cork. The temperature of the water goes up and up. Still it can't let off steam. Gradually tremendous pressure builds up way down inside the cavity.
Then at last something has to give. Steam presses so hard that water rises through the narrow neck of the geyser and spills over. With this water gone, more water down below turns to steam like a flash. It, too, is pushed out.
Faster and faster, water changes to steam. More and more water is forced up the narrow tube. It rises in a solid column, higher and higher into the air. Then everything stops as suddenly as it began. The cavities down below are empty. They must fill up before the geyser spouts again.
Castle geyser