There are a couple of branches of this question, making it harder to answer coherently, but here I go.
If you want to make a league of gentlemen out of the general criminal underworld, you would first make them organized, into a criminal organization. For that, you'd need a charismatic leader, people who will follow that leader, and new recruits who need or gain something by joining this group. For example, a gang starting with a man with leadership skills, organizes his loyal friends (or maybe contacts, I'm not fluent in the social expectations of the criminal underbelly), and then you get people off the streets who need the money or just a job. Freakonomics, a non-fiction book that uses the rules of economics to explain otherwise-unexplainable phenomena has a chapter about a gang based on drug dealing, and it was built much like a corporate organization. Someone was calling the shots (like a CEO), some people had power and important responsibilities, like managing recruiting or drug intake and outflow (the board of directors), important higher-ups like drug-transporters and local recruiters (like department or store managers), and then you had the "bottom feeders", the actual dealers who were paid the least and could be easily replaced, but took the dangerous job for financial purposes (retail-floor workers).
So now you've got an (very) organized group involved in crime. It has strong footholds, loyal members, safety nets, a wide network, spies even, etc. They exist because something, usually a practice or good, wasn't legal (if it were legal, it wouldn't be as appealing or profitable to the originator of the criminal organization, or the alternative is they're a legal organization). Like drug or human trafficking. And even though their actions often are directly harmful to people and/or require violence and murder to enforce their territory, sometimes they were benevolent. Mafia families did actually have a sense of family and loyalty among their own families, and were said to have arranged marriages for alliances just like historic royalties. And both gangs and mafias did follow through on the "protection" they charged for, defending stores that paid the protection fee from criminals or rival gangs. So criminal organizations did actions for revenge, to preserve their own existence, and profit. It doesn't make much sense for a criminal organization to go story-book evil or serial-killer psychotic and harm people for no reason.
But turning them into the good guys is likely very conditional and challenging. Let's talk about Suicide Squad first. It's a special operations task force made from skilled supervillains and supercriminals on a work-release program. Some notables are Bane, Black Adam, and in the movie, Harley Quinn and the Joker. Their motivation is they get to shorten their prison sentences by performing covert tasks for the government. They also probably find it fun, as it can be similar to their crime life and the thrill is just great for supervillains.
Most long-time criminals pick up something while they're in the business. Drug-dealers may learn sales skills, for example. They also may perform their criminal duty in the opposite direction, like hackers working to prevent other hackers from succeeding and Frank Abagnale, whose story was adapted in Catch Me If You Can, used his skills in faking identities to help stop identity theft. The problem with retribution prison that the US has is that criminals often become law-abiding citizens and either lack the skills and education to get a job or it's impossible to get a job, and so they return to crime, as they've learned to be good at it, and it's all they know. Give them a legal job requiring their skills and make it just as or even more profitable than their criminal one, and you've good a good guy.
But if you want to turn a whole criminal organization into a legal league of gentlemen, well then you have to do that on a macro-scale and be sure that the organization can still exist in the legal world. The Prohibition era mafia families fell into disarray because there wasn't any room for a smuggling and distribution operation like them; those facets of the economy were already in place. You would have to make sure that leadership is stable and that the legal side of business is profitable and appealing. For example, Anonymous, a very well-known hacking group, has accomplished hacking feats far superior than both the NSA and FBI and manage to hide their traces better. You could employ them directly into the NSA and FBI or make them an independent branch on their own, or maybe even an exclusive contractor. I'm sure there are other organizations I'm not aware of or are still underground, but they also fit this bill.
Far easier though, is to make this organization a vigilante league of gentlemen. Essentially chaotic good anti-heroes, they can steal from those deemed evil or corrupt and give to those in need. Pretty Boy Floyd was a bank robber who gained appeal and praise from citizens by burning the records of their mortgages and debts. Some gangsters, like Mickey Spillane had the media perception of a "gentlemen", and avoided violence when he could and never allowed drug trade or violent mobs in his territory.
So change their business from selling illicit drugs smuggled in or grown/made locally to stealing from pharmaceutical companies and pharmacies and selling necessary and helpful over-priced prescription at a far lower price or for free. The only people who really suffer are the owners, share-owners, and high-higher-ups in this corporate conglomerate, so nobody good is getting hurt. This is sometimes how revolutionary sides or rebels act, actually, during civil wars. There are stories all over, but I don't want to quote anything because there wasn't a completely benevolent revolutionary side.
So, to recap and summarize. A for-profit organization starts when there is a profitable business or source of income, and it's built when there are different responsibilities that need to be fulfilled in order to maximize profits. If the business is legal, then the organization is legal, and have monopoly through patents, non-compete agreements, oligopolies or "industrial hegemonies", etc. They may also have government regulations. If the business is deemed illegal, then the organization is illegal, and each criminal organization often controls the different facets of production, like imports all the way the distribution, and have no regulations (since the whole practice is illegal).
To make them legal, give them a niche to fit into within the legal world, like the aforementioned hackers becoming anti-hackers or drug-dealers becoming salesman, or if you're not going for realism, trained killers doing government-sanctioned trained-killing. To make them gentlemanly but not legal, make their source of profit harm the guilty or those who won't suffer too much (like uber-rich) and ensure that it doesn't harm the innocent and needy, and make sure their goal is to help those in need.