Where did gangster rap come from?

Gangster rap came from rappers like Tupac and most olddies who rapped so they could get away from gangs, but they still rapped about everyday life for a gangster.