Why did Jon admit that he killed Daenerys in Game of Thrones S08E06? Why didn't he just tell that she flew away with her dragon? He could say that, escape from the Unsullied and then tell the truth. I understand that there was blood and a melted throne, but he could come up with something.
Jon Snow is a man of honor. It's part of his core personality.
His own personal care is less important for him than being honorable and doing the right thing for the people.
Running away after killing someone (no matter who or what the reasons are) is a very cowardly act, so it's against his very nature.
Also keep in mind he didn't try to run away from the dragon, but instead faced it and was fully prepared to be burned alive as a consequence of his actions.
Another point is the "right thing for the people" part. Suppose he would have fled and the people found out about what happened when he's away. The Unsullied would surely act against the people, and likely many people would die until peace is somehow restored.
Because he is a man of honesty and it has been shown in his own words before (from season 7 finale):
"I'm not going to swear an oath I can't uphold. When enough people make false promises, words stop meaning anything. Then there are no more answers, only better and better lies."
And if you go by his arc he can lie and cheat easily to get away many times before but he will not he is an honest man.
In addition to the other answers, we should remember that Jon was not just in a relationship with Daenerys but was in love with her. He killed her despite his love for her, because of its importance to everyone's lives; but it was still absolutely heartbreaking for him not only to lose her but to be the cause of that loss. I would imagine someone in that situation to feel absolutely desolate, to the point of not caring what happens to him next—perhaps even with the feeling that he deserves to and/or wants to die.
In addition to this being precisely in-character for Jon, there is precedent for Daenerys leaving with Drogon. She did exactly that after the Sons of the Harpy attacked her in the fight pits of Meereen.
And what happened after is that everyone continued what they were doing until Dany returned. Her regime was upheld, awaiting her return. The same would have happened in this case.
So even if Jon had gotten away with it without being imprisoned; he would not have actually stopped the atrocities that were going on.
In addition to the other answers which I think are the primary reason (honour), consider that lying probably would have raised more questions anyway. It would be very odd of her to simply fly away without saying anything, and in time the suspicion would only grow.