The heat energy obtained from the hot rocks this is present inside the earth is called geothermal energy.
In the place where earthquakes and volcanoes are active, the temperature increases highly in comparison to normal. The hot underground water can be brought to the surface, fill the hole, and covered by earth. Two holes are made in the upper surface. In one of them, cold water goes inside, and in another hot vapor comes out.
This hot water vapor is used to run the steam engine rotating turbine to generate electricity.