Warning: This post contains major spoilers for the final episode of Game of Thrones.
Drogon understood that it was the corrupting influence of the Iron Throne and not Jon that ultimately caused his mother’s death.
One of the main theories about why Drogon spared Jon is because he understood that the Iron Throne was the actual cause of Dany’s death. It had been the reason behind endless suffering and destruction. It had taken over Dany’s very being and corrupted her soul in the process. Jon was just doing what was necessary, for the greater good.
Jon is a Targaryen, which means he is family (and also possibly impervious to fire).
Another theory that’s also fairly obvious is that Jon is a Targaryen. He’s one of the dragon people himself, and could thus withstand fire just like Daenerys. Drogon always sensed that Jon was a Targaryen, and realised fire would do him no good.
Drogon assumes Dany got stabbed by one of the many swords on the Iron Throne.
There’s also a theory that Drogon was just stupid AF. This theory posits that Drogon saw a knife sticking out of Dany’s heart, looked at the Iron Throne with all its pointy bits, and just assumed the Throne killed Dany.
Dragons are unpredictable creatures who can never really be tamed completely, especially when they’ve lost their rider. Maybe we’ll know the reason he spared Jon one day, in George RR Martin’s extended fantasy world. For now, all we have are theories.