Subduction consumes lithosphere and since the surface of the earth is a constant, it compensates for the amount of lithosphere created at divergent plate boundaries.
Magma generation in subduction zonesWhen the (typically very old) oceanic crust sinks back into the mantle in a subduction zone, it comes progressively under greater pressure and temperature. Its rocks contain significant amounts of water, carbon dioxide and other fluids which are released into the overlaying mantle wedge.
Melting the mantle by adding fluids
This addition of fluids lowers the melting point of the mantle (in a similar way as adding salt lowers the melting point of ice). As a result, the mantle rocks in the wedge overlying the subducting slab produce partial melts = magmas.
As the magmas are lighter than the mantle and start to rise above the subduction zones to produce a linear belt of volcanoes parallel to the oceanic trench. The best example are the subduction zones around the Pacific Ocean, often called the "Ring of Fire".
Magmas change composition
The magmas in subduction zone volcanoes are often explosive, because they arrive at the surface as very sticky (viscous) and gas rich. Why?
On their long way up to the surface, these magmas can (and typically do) undergo a variety of processes, such as cooling and partially crystallizing when they pool and cool in magma chambers at different depths. This lets them cool down, which results in the partial crystallization of the magmas.
As different crystals grow from the magmas, the remaining fluid magma changes its chemical composition from the original hot basaltic (silica-poor, iron/magnesium rich) to progressively more silica-rich compositions such as andesitic, dacitic or even rhyolitic.
Explosive fragmentation of sticky, gas-rich magma erupted at Krakatau volcano, a typical subduction-zone volcano.
As magmas in subduction zones are typically richer in silica, they are also much more viscous. At the same time, they still contain most of their fluids (mostly water, carbon & sulfur dioxide). At the surface, these fluids will form bubbles, but sometimes are unable to escape the sticky magma other than by explosive fragmentation.