why all these powerful criminals insist on operating in Gotham when so many other cities would be safer
Gotham sits above a Lazarus Pit, which is partly why there's so much crime to begin with. Groups like the League of Shadows know about it, which is why they continue to invest in taking over the city. In some canons, Bane's strength enhancing drug is made using the Lazarus Pit.
This has an affect on the rest of crime in the city. The groups vying for control need funding to fight each other, which means drugs/guns/racketeering/gambling/prostitution/legitimate businesses to act as fronts in order to bring in cash.