In areas where volcanoes are common, the rocks below the ground are very hot. If you drill holes down to these hot rocks and then put pipes filled with water down the holes, the water will turn to steam. The steam can then be used to produce electricity.
This is called geothermal energy. It releases no carbon dioxide and so is a green way of producing electricity or heating a town. However, it can only be done in places where the rocks are hot.