Because that’s how they did it in Menace II Society.
Journalists and gun experts point to the 1993 Hughes brothers film Menace II Society, which depicts the side grip in its opening scene, as the movie that popularized the style. Although the directors claim to have witnessed a side grip robbery in Detroit in 1987, there are few reports of street gangs using the technique until after the movie came out.
But the side grip can also be practical:
During the first half of the 20th century, soldiers used the side grip for the express purpose of endangering throngs of people. Some automatic weapons from this era —like the Mauser C96 or the grease gun — fired so quickly or with such dramatic recoil that soldiers found it impossible to aim anything but the first shot. Soldiers began tilting the weapons, so that the recoil sent the gun reeling in a horizontal rather than vertical arc, enabling them to spray bullets into an onrushing enemy battalion instead of over their heads.
But mostly it just looks cool.
Update: TV Tropes has an entire page dedicated to the Gangsta Style shooting technique. (thx, grant)