Warning: Spoilers for Game of Thrones episode "The Long Night"
-
The Night King was finally killed in Arya was the one to kill the Night King when all hope seemed lost. But why was it that the battle got to this point, when Daenerys and Team Winterfell had been so convinced that they could deal with the leader of the Army of the Dead with dragonfire?
"The Long Night" started with a shock, as the Dothraki (and their flaming swords) were completely destroyed by the Army of the Dead. The Team Winterfell battle plan quickly fell apart, as the Night King brought in a magical fog that stopped dead in the crypts were brought back. However, one part of the plan did go as expected: the Night King was drawn out, and Daenerys was able to hit him with a blast of dragonfire. Except, of course, that it left the big bad without a scratch.
In retrospect, it shouldn't be too surprising that the Night King wasn't hurt by dragonfire. Not only did Bran say that he didn't know if dragonfire could hurt the first of the Walkers, but fans have actually seen him walk through fire in the past. Unlike most of the wights, who can be destroyed with fire, the Night King has repeatedly shown that no mere flame is going to take him down. In fact, he dealt with dragonfire when he killed Viserion, so Team Winterfell should have known that their plan to take him down with a dragon was not going to work.
One of the most popular theories about why the Night King was able to through the fire without a scratch is that he is actually a secret Targaryen. This would explain the creation of the Night King by the Children of the Forest, and that happened long before the Targaryens left Old Valyria and came to Westeros. So unless he happened to be a rogue Targaryen who just so happened to be in Westeros at the time, it's highly unlikely that this is why he survived.
What's more likely is that the Night King's magic is so powerful - and so connected to the cold - that it is able to withstand fire. In this episode, it was shown that not only does the Night King have the ability to raise the dead (and it still hasn't been totally explained how), but the killed by Valyrian steel - this fire magic is the only thing that can destroy the ice magic that the Night King possesses.
In some ways, this is a deeply unsatisfying ending for the big bad of the past seven seasons - it's still not clear who he was (beyond an early man who was changed by magic), or how he gained the magic that he has; it's all simply explained away with a wave of the hand and a nod to the magic of the Children of the Forest. The true explanation for exactly why dragonfire doesn't hurt him may never be revealed, although speculation about secret Targaryens and ice/fire magic will continue to swirl around him for the next three episodes - as the threat changes from being the Night King to Cersei Lannister, and potentially to Jon and Daenerys at odds for the Iron Throne.