The G stands for Government, as FBI agents work directly for the U.S. Federal Government rather than a local police department.

The term was allegedly coined by gangster George "Machine Gun" Kelly1 in September 1933. While being arrested by DOI agents (Division of Investigation, a precursor to the FBI), Kelly yelled at them Don't shoot G-men, don't shoot.

1http://www.fbi.gov/libref/historic/history/historicdates.htm