Community Matters
It is common for conservatives to say that cities are crime havens, and while it is true that cities have more crime, in is not because of "moral degeneration" or "the minorities" like they love to claim. In reality, one of the most important factors to preventing crime in a neighborhood is the community of people who live in it - and subsequently the location of where the neighborhood is.
Social Disorganization
Social disorganization is a situation where there is minimal community feeling, relationships are transitory instead of long-lasting, there are few (or zero) means of informal control and community surveillance, and social organizations do not exist or are ineffective. A socially organized community has the opposite of this. In socially disorganized neighborhoods, there are many conflicting values (cultural and moral) - socially disorganized communities often are home to different cultural groups (Znaniecki ,Thomas 1920). These different cultural and ethic groups often enter conflict over resources that are scarce in these impoverished neighborhoods, which breeds crime and delinquency. Consequently, this evolves to a means of income which leads to gang formation.
Social disorganization seems to be common in mixed use neighborhoods that evolve over time. A classic example of this is Chicago in the early 1900s, where high-crime neighborhoods existed near factories - with high levels of transient population and ethnic diversity. In these neighborhoods, crime becomes an alternative to mainstream economic and social activity - police eventually give up on these neighborhoods, which increases crime and "moral cynicism" in the neighborhood, which makes the neighborhood even worse. Crime increases, more and more people become targets of the criminal justice system, and crime becomes part of daily life. In effect, social disorganization can lead to a feedback loop, which is incredibly hard to break (Stark 1987).
ethnic diversity as a component to social disorganization does not mean some ethnicity are more prone to crime than others, but instead means that crime may arise from heterogenity from ethnic differences and difficulties in communication
Why Join a Gang?
Gangs provide an escape from disorganized communities by providing an income, values, and community. A 2006 survey showed that there were 26.5k gangs nationally, with a total of 785k members. Gangs generally create more "problems" in the cities. Gangs provide income in the form of drug related sales by offering access to the local drug economy, though drug sales are not inherently organized in every gang, the more organized a drug scheme is in a gang, the more money it makes.
It is important to remember that most people do not want a gang to be a permanent situation, in fact a 1997 report indicated that 45% of gang members that were interviewed tried to quit, and 80% would quit the gang if they had a second chance (Knox, Harris et al. 1997). Gangs are also not the entire identity of a gang member, many are students, churchgoers, etc.
In Summary
Gangs are not inherently evil or criminal, but they arise from communities where there is little social organization. Gang violence is a very real problem, especially when conflict arises between gangs, which is part of what we are seeing in Minneapolis, but this is a solvable problem. I strongly believe that by becoming more connected within communities, the opportunity for crime and gangs to arise can be eliminated - this presents an opportunity for socialists to create community groups and means of facilitating social organization. Read The Dual Power.
Why join a gang? To terrorize the squares with your incredibly aggressive queer violence polycule. Marx literally wrote about this.