The heat was produced when the Earth formed 4.5 billion years ago. Volcanoes are the main way that the Earth releases heat.
Volcanoes can be very dangerous and have killed many people in the last century.
People live near volcanoes because they are beautiful, good for agriculture, or the only land available. Some volcanoes are not monitored, so volcanologists will not be able to warn people as an eruption becomes more and more likely. Thank you for your question.