I lean towards Leven's theory, but as an alternative I propose: Drogon knew there was something wrong with Dany and that it was best that she die.
So he grieves for the loss of his rider and "mother", but does not punish the man who did what needed to be done.
He may have even melted the throne specifically as his last act to help "break the wheel", communicating the idea that heritage and birthright to the throne are now lost; that Jon in particular is not automatically the rightful ruler, and something new must be built.
movies.stackexchange.com/users/55380/zibadawa timmy
Dragons clearly have an unspoken connection to the Targaryens.
Jon is a true Targaryen by birth.
Jon and Dany are the only people we've seen ride dragons, and history tells us that only Targaryens can ride dragons.
Drogon recognizes Jon as a Targaryen, so he allows him to enter the remains of the Red Keep.
He probably didn't know what Jon would do, but as a Targaryen, Drogon couldn't stand in his way.
When Drogon realized that Dany was dead, he was obviously furious.
He may have even wanted to kill Jon.
But in the end, he realized that Jon was the only living Targaryen, and couldn't kill him.
Apparently a great-uncle was better than nothing.
movies.stackexchange.com/users/57106/LevenTrek
In-universe it's unclear if we can attest Drogon either a full consciousness of the events or just a magical intuition for what's right.
It doesn't exactly matter if his intelligence is more of a conscious, universal or emotional nature.
But ultimately what matters is that he realized what was really going on and that the "wheel" is ultimately at fault and needs to be broken .
So yes, he doesn't particularly like that his mother is dead, but neither
does Jon afterall.
But they both realize that it needed to be done.
And I think you can go even further than this.
The dragon as this enigmatic and majestic creature is actually necessary for exerting this ultimate act of reason on the world and doing what Dany as a mere mortal is unable to do, not just physically but generally.
While the story is primarily a political drama, it was always expected that the more otherwordly factors of Game of Thrones are what ultimately has to call the humans to reason in their useless struggle for power.
And in fact, the only major thing I was really disappointed about this last season was the way in which they shoved the White Walker threat out of the way seemingly prematurely, because of the above expectations that they were necessary for "breaking the wheel".
So it was somewhat of a relief to see, if not the Ice, then at least the Fire to rise above the human characters and stand in for what is the only right thing to do , no matter if it did so conciously or merely out of an intuitive feel for universal justice as part of its magical nature.
And in the same way it's notable that this is a level of elevation noone really gave these creatures credit for, not Dany for whom they were her children but also largely weapons, nor Jon who expected Drogon to kill him as much as us viewers, until we all realized that they are ultimately above us and quite simply out of this world .
movies.stackexchange.com/users/49/Napoleon Wilson
He did not know whether it was Jon or not.
He just saw her lying there and Jon mourning her death.
He might have just thought that someone else did it.
We do not know how intelligent the dragons are and whether they can deduct beyond the pure visible.
movies.stackexchange.com/users/66165/Goodbye SE
Agree somewhat with Kami Kaze.
My theory, which does not entail much calculating consciousness: He didn't see her get murdered, so the familiar Targaryen in the room was merely a neutral, protected presence.
However, he was sad and angry, and so vented on the nearest available big thing.
movies.stackexchange.com/users/74414/user3254488
In extension to this  question  about  Game of Thrones  S08E06, why did Drogon leave Jon after the death of Drogon's mother? Drogon had consciousness to destroy the Iron Throne.   We all know that Drogon allowed Jon to pet. Does Drogon have the consciousness to forgive as well or doesn't Drogon know who killed the Mother of Dragons?
Why didn't Drogon attack this character?
movies.stackexchange.com
<plot-explanation><game-of-thrones>
movies.stackexchange.com/questions/100907
movies.stackexchange.com/users/46039/ashveli
It is possible that Drogon knew there was something wrong with Dany and that it was best that she die.  He may have even melted the throne specifically as his last act to help "break the wheel", communicating the idea that heritage and birthright to the throne are now lost; that Jon in particular is not automatically the rightful ruler, and something new must be built. Drogon understood there was something wrong with Dany and so it was best if she was to die. He may have possibly even immolated the Iron Throne as his final act to convey the idea that his heritage and bloodright has been rendered meaningless.
In contrast, I favor Leven's hypothesis, but as a possibility I present: Drogon understood there was something wrong with Dany and so it was best if she was to perish. He may have possibly even immolated the Iron Throne as his final act to convey the idea that his heritage and bloodright has been rendered meaningless. For all he knew, she was still alive when he left the room. It was unknown if it was his name was Jon, or if not.