The reason volcanoes are formed is because the temperature under the surface of the Earth becomes hotter and hotter the deeper you go. At a depth of about 20 miles, it is hot enough to melt most rocks.
When rock melts, it expands and needs a lot more space. The pressure also builds up. This molten lava rises along vertically. When the pressure in the center of the volcano becomes too great, it simply erupts.