The man regularly outwits far more supposedly cognizant opponents including Batman and Lex Luthor, who are canonically recognized as two of thr smartest people on the entire planet.
Edit: I’m not saying insane people are stupid, I’m saying that Joker’s mental illnesses are pretty obviously behavioral, they don’t affect his perception of reality. He’s perfectly capable of understanding what he’s doing and how it’s wrong, in fact his character almost doesn’t work if he doesn’t, he just thinks that it’s all hilarious anyways. That’s why I said he’s not insane, he just pretends to be, because he’d be fit to stand criminal trial as fully competent and cognizant of his actions.
There’s this really entertaining forensic psychiatrist named Eric Bender who does multiple analyses videos of pop culture “insane” characters.
So the movie versions of Joker aren’t insane in the sense that they’re lost in hallucinations and unable to discern reality from make-believe. The Joker wouldn’t likely be sent to an asylum in the real world. The Jokers of the movies are psychopathic, evil, uncaring, manipulative, etc. For the most part, to them the world is a game and it’s all about the Joker being the main character with everyone else being pawns to be used for evil pleasure.