I can't speak completely to the LA gangs, but the Chicago gangs originally formed for neighborhood protection against white gangs, as blacks were moving to Chicago and being placed in neighborhoods that were "ethnically" white (Italians, polish, jews), and they were met with opposition. Gangs that became the BDs and P Stones were getting government grants for community centers, mentorship, etc.
Not to mention, the extreme violence mostly didn't happen until heroin was introduced into the community and the gangs became drug enterprises. Who introduced the heroin? ...The Italian Mafia.
(I'm not defending gangs)