He was trying to create his own thing, not embrace a traditional gangster lifestyle but instead create a new one. He put himself in a leadership position through art to change the way “his community” (what he saw as his community) would behave. He was trying to advance the black panther movement into the modern era, and reform it to make it palatable for 90s youth.
Well, that’s the theory anyway. He wrote a “code of thug life” and clearly wanted it to appeal to people who saw themselves as hard and violent.
If you do a deep dive into the Reddit pac conspiracies or read more about it, people seem to think that Pac wanted to be a leader in the black community like Elijah Muhammad or Malcom X but the culture had shifted so as to make that impossible for anyone but a rapper or athlete; the era of the black revolutionary intellectual was over, at least in his mind, so he tried a different route. Sadly most of the major “black liberation” activists in the 20th century were murdered one way or another.
Now this is only a theory; but it is something that is floating out there you might find interesting. I’m not saying all this stuff is 100% true but it’s what some people think.