There are 3 main strands going on here - classic crime movies of the 1930s, movies about the Mafia and organised crime, and movies about black/youth gangs from the late 20th century on. They're not the same thing. All of the recommendations on this thread are great ... here are some more from category 3:
Dead Presidents (very underrated IMHO)
Juice (not exactly gang-related, more of a drama about friends tbh but a great movie and worth it for Tupac Shakur's performance alone)
Better Luck Tomorrow (Asian Californian gangs, an interesting flip of the script)
Mi Vida Loca (Chicano gangs in LA)
Or of course you could just watch all 60 hours of The Wire again, because apart from being the best thing ever made (TM) it's also by far the best about the real internal and external dynamics of gangs, what makes them survive or not and the personal rivalries inside them.