With increasing depth inside the Earth, it gets hotter. At some places this heat energy comes in contact with groundwater and heats it up, so much so that when it reaches the Earth’s surface it turns into steam. This steam or hot water can be used to run a turbine. The turbine will rotate the generator which in turn produces electricity.