Mostly thought of as short for "gansta" (see just about all other "G" entries), but originated as a shortened form of "gringo," which is a generally-pejorative Spanish term (mostly Latin American rather than European Spanish) for "foreigner," typically a white male North American or Briton.
Dude: "Yo what is it that is up, my G?"
Chick: "Hey, I'm not a G. I'm a black female Brazilian."
Dude: "Oh, then I guess I don't understand the real origin of the term 'G.'"
Chick: "You got that right... G!"