The basic explanation of what happened is simple: the UK instituted a carbon tax that made coal more expensive than natural gas per unit of electricity produced, so British utilities shut down their coal plants and replaced them with gas plants as quickly as possible.
The backstory is somewhat more complicated, and much more interesting. The British tax was implemented in 2013 as a local fix to a broken EU carbon-trading program; that program, called the Emissions Trading Scheme [1], allocated to electrical utilities in the EU the right to produce a fixed amount of carbon emissions (and carbon-equivalent emissions), and the rights were made transferable—a typical cap-and-trade set-up. And then the basic problem with that typical set-up occurred: the fixed supply of rights to produce emissions proved higher than the EU's electrical sector's total demand, a consequence mostly of lower than expected demand for electricity during the recession that followed the financial crisis of a decade ago, but also partly due to other clean-energy initiatives and to big changes in world energy markets. And so the price of emissions rights collapsed.
That wasn't really a problem—no more carbon was being pumped into the air than the ETS allowed—but it made plain the fact that the ETS was doing nothing at all to reduce emissions. So British lawmakers decided to implement their own carbon tax, called the Carbon Price Floor [2], in order to reduce emissions and support the development of clean energy. The tax rate Parliament set was one of the highest in the world, and as it turned out it was just high enough to make coal slightly more expensive than natural gas for generating electricity, an outcome entirely unforeseen when the policy was decided, just as global production of natural gas was beginning to boom and its price to plummet.
So in the end, a bunch of poorly designed policies and their unforeseen consequences led to a better than expected outcome: Britain has been weened off coal decades earlier than was thought possible.
0. http://www.carbonbrief.org/analysis-uk-cuts-carbon-record-co...
1. https://en.m.wikipedia.org/wiki/European_Union_Emission_Trad...
2. https://www.gov.uk/government/publications/carbon-price-floo...