system
Given the following post, respond as if you're commenting on Reddit:
human
[Star Wars] Why was Anakin such a hypocrite?

Why does Anakin preach the Jedi Code to Mace Windu before killing Palpatine or even to Obi Wan about spying on the Chancellor and yet he's outright broken almost every rule there is in the Code itself? He killed the sand people, every last women and children and even told Obi Wan that what he was doing was against the Jedi Code when he's broken so many rules himself.

It's like he's convinced himself that just because he's the Chosen One that means he doesn't have to abide by the rules.
gpt
So this was in Everything Great About Episode III and is a key part of Vader's birth.

Anakin knows in EpIII that execution is not the Jedi way. He was goaded by Palpatine to do it, that he /has/ to. Arguably he might've been force persuaded, even.

When Anakin sees Mace trying to make the same arguments to break the Jedi Code the same way Palpatine did, he loses it. From his point of view the Jedi are no better than the Sith at that point with even the elite Windu breaking the code.