One Piece fans often ask the question "Why did Denjiro turn bad?" in the Wano arc because his actions tend to be somewhat confusing to the audience. He is initially presented as the leader of a yakuza group and for working for Oden's usurper, shogun Kurozumi Orochi, but then he is seen helping Hiyori Kouzuki throughout the arc, thus adding to the confusion.
Simply put, Denjiro was pretending to be bad in this One Piece arc while he helped Hiyori and the poor on the side, biding his time so he could get the chance to take down Orochi and Kaido. This opportunity arrived during the events of the Wano arc, which is something that happened when the Straw Hat arrived and the chain of events began to take place.
Disclaimer: This article contains spoilers from the manga/anime.
Denjiro's actions after Oden's death, explained

Denjiro was one of Kouzuki Oden's retainers and one of the Nine Red Scabbards, but he was struck by grief after his leader's death at the hands of Kaido and Orochi during the events of the Legendary Hour. His facial structure changed greatly along with his hairstyle and went by the name of Kyoshiro, forming a yakuza family and becoming a crime lord in the process.
This change led to him getting into the good graces of Kurozumi Orochi, to the point he started working as his money changer and bodyguard, slowly making him more influential throughout Wano. The success of the Kyoshiro family was also aided by the contributions of the Beast Pirates, thus making him capable of providing for Hiyori in the process.
Denjiro's true allegiances in One Piece and how they're confirmed

As mentioned earlier, the real answer to the titular question is that he never truly became evil or anything along those lines. He knew that he couldn't take down Orochi and Kaido after Oden's execution, so he was biding his time until the Nine Scabbards could reunite and also focused on taking care of Hiyori, which is shown throughout the arc.
Besides the fact that he took care of Hiyori so she could become the to become the oiran Komurasaki, Denjiro also took the moniker of "Ushimitsu Kozo" and disguised himself to steal from the rich to hand to the poor.
This is a prime example of how his morality never changed after Oden's death and was putting on a facade to get closer to Orochi and Kaido while amassing power and resources to compete against them.
Furthermore, the audience can see this with him waiting for Kin'emon's return for the past 20 years and the statement he makes to Orochi about how he couldn't wait to show the latter his skill with his blade if the former returned. While it was initially interpreted as a desire to take Kin'emon's life, it was actually a warning to his sworn enemy.
Final thoughts
So, the answer to "Why did Denjiro turn bad" in One Piece is that he never did and was only waiting for the right opportunity to get back at Orochi after what happened to Oden and the latter's atrocities inflicted upon Wano. He also proved to be a loyal ally to Oden even after his death since he took care of his daughter, Hiyori, for more than a decade.
Related articles
- One Piece chapter 1145 all but confirms Rocks D. Xebec's strength and influence
- The One Piece anime's return failed to fix this major Egghead Arc plothole
- One Piece chapter 1145: Gunko targets the Straw Hats as Loki's history with Rocks D. Xebec is shown
- One Piece chapter 1145 teases this character having the Voice of All Things (& it's not Sanji)