Put simply, the gases dissolved in magma at depth start to appear as a gas phase as the magma rises to lower pressures (i.e. bubbles). The gas then accelerates upwards driving the magma with it and separating it into fragments. The early phase of an eruption usually has more gas than the later phases. That’s why many eruptions start with an explosive phase and end with a lava phase.
There’s also an important physico-chemical effect. Magmas that are rich in silica are also more viscous, so get blasted apart by the gas more easily and form bigger eruption clouds with higher proportions of fine ash. That’s what happened at Chaiten (Chile) for example.
This answer was written by Dave McGarvie, a volcanologist with the Open University and was originally posted as part of his Reddit AMA.
Take the time to read more of the questions Dave answered on Reddit.