Did danzo genuinely believe he was a hero and was doing what was right?
GOOD QUESTION. I have no idea. Or at the very least I am rather uncertain about it.
Personally, I don't think that Danzo has done a singular good thing. But unfortunately, what's wrong and right is not a universal concept and the answer to your question strongly depends on Danzo's personal views on morality.
Morals are heavily influenced by two things: Empathy and societal norms.
As I explained in a previous ask, Danzo doesn't really seem to be that capable of empathy.
And the issue with Narutoland is that its society condones many forms of violence. Murder, mutilation, torture, and manipulation may be considered "cruel" but are mostly just regarded as a means to an end.
Danzo's views on "Right and Wrong" might already be severely skewed simply because of his lack of empathy and the societal norms around violence in his world.
Danzo's Morals
I personally believe that Danzo's morals are mostly based on societal norms and utilitarianism (due to his lack of empathy), not on actual care for others. That's what his flashbacks from chapter 481 seem to imply.
He considers sacrificing himself not out of care for others but out of a desire for recognition and to adhere to the idea of what their society considers to be a "proper shinobi".
This is also highlighted when his main concern with Hiruzen's sacrifice is not the latter's wellbeing but the "limelight" stolen from him. Interestingly, when Tobirama suggests sacrificing himself, Danzo's protests appear to be in concern for the village (and its safety).
What is important to understand is that those are not necessarily "bad" moral principles to abide by. The societal norm in question here is the idea of "self-sacrifice" in service of the "greater good" (utilitarianism). The purpose is the preservation of a population.
I think the issue with Danzo is that he doesn't follow his own principles while imposing them on others and then driving them to the extreme.
Danzo's Selfishness
Danzo's actions all don't really seem so much in the interest of the greater good. His Hokage fantasies aside, for Danzo everything is not so much about the preservation of the population as it is about self-preservation.
Yes, he does end up "sacrificing" himself at the end of his fight against Sasuke. But please contrast this with his flashbacks. His resolve falters because he is scared. Because even though he does believe in the values he advocates, he does not have the guts to follow through with it. In chapter 481 he is not sacrificing himself just because he wants to protect others but because he knows he is dying anyway and there is literally no reason not to. This is his last-ditch effort to die in "glory" rather than shame.
And no, being scared is not a moral failing. It is, however, if you demand sacrifice from everybody else while not following through yourself. That is hypocrisy.
I should also mention that, in Danzo's defense, he seems to be aware of his own lackings in comparison to Hiruzen (both in the flashback as well as when he dies). However, it is unclear whether this is in relation to his own cowardice and moral failings or only to the fact that he never got to be Hokage.
Verdict
While I still consider Danzo to be a POS, there are grounds to believe that he considers himself to be the "good guy". The reasons why his self-perception would differ from ours are...
His lack of empathy, substituted with blunt utilitarianism
The society of the ninja world that normalizes violence
Cowardice and self-delusion that ignores his own hypocrisy
While I won't get further into the details, he might also make use of moral disengagement to dodge responsibility for his own cruelty.
And, in spite of everything, it is entirely possible that Danzo is aware of his failings. If he is, I personally believe that this is an aspect he dislikes about himself (looking back at chapter 481). In either case, Danzo probably does not intend to be "bad" or "evil" but rather it is a product of his own hypocrisy (mixed with all the other factors mentioned above).
But what the answer to your question comes down to is whether or not Danzo is not only capable of recognizing his failings but also judging them accordingly. And that is entirely up to interpretation.










