Japan is an ultraconservative hellhole, their law & justice system is probably the most backwards in the first world. Their crime management is pretty much just fascism many times, extremely out of proportion punishments for the crimes, and if the government accuses you of something and it goes to trial, you’re basically toast. They all but torture you while you’re being processed, often times they use harsh treatment to try to force a confession out of you before trial. The state prosecutor also has no legal obligation to present all the facts, they have a lot of freedom to cherrypick and withhold information relevant to the trial in order to make the defendant look as guilty as possible.
They have a 99.8% criminal conviction rate.
Japanese inmates are often treated inhumanely, the way Japan treats prisoners regularly would be considered a human rights violation in most western countries.
Imagine how Republicans treat criminals, and multiply it by a hundred. Japanese society/government HATES anything that’s out of order and does all it can to stamp out any “deviance” from norms. This usually results in them treating financial crimes, theft, drugs, etc. extremely harshly, but doing pretty much nothing about crimes like sexual harassment & sexual assault, which are kind of culturally prevalent or even slightly acceptable in Japan. Legally rape victims are treated far worse than rapists. You’d even probably be treated leniently for DUI as long as it wasn’t a taboo/illegal drug (i.e., if it’s alcohol).
The reason urban Japan seems so nice and orderly is similar to the reason that the streets of Pyongyang seem so clean and behaved. Extremely terrible treatment of people who step out of line, except in Japan it’s mostly culturally than politically. There’s a reason they’re known for suicide and hikikomoris.
It is a very common misconception that Japan is very progressive because of anime and the extremely rampant sexualization/objectification of women in the form of cute/funny things like panty dispensing machines and wacky television game shows and cat girls, and in general Japanese stuff just being very bright and bouncy and all that. But it’s very misleading, their culture obsessed with cuteness/“kawaii” stems from an attempt to radically and rapidly distance their cultural image from that of Imperial Japan. They definitely succeeded in changing the world’s perception of them, but they didn’t address their deep societal issues which were in part caused by the US basically controlling their politics after WW2.
I should point out though that not all Japanese prisons are dystopian torture chambers. But you still get very few rights and freedoms while imprisoned, even socializing may be completely forbidden.