Originally Posted by Bagistan
It's from the USAF. The G is for Ground intelligence. Naval intelligence is N2. The 2 is from when the french had two intelligence bureaus, the first for information about friendly forces, and the second for enemy intelligence.
G2 was around before the USAF existed. G stands for "General" staff. The 2 designates the unit's intelligence office. So G-2 is the intelligence office for a headquarters commanded by a General. (Division, Corp, etc)
S-2 is the intelligence office for a headquarters commanded by a colonel. There are other staff offices as well. S-1, personnel; S-2, intelligence; S-3, Operations; S-4, Supply, etc. For a brigade or battalion, they are "S" shops. For Divisions, they are "G" shops but the numbers are the same.
So it's common military slang to refer to intelligence or any kind of secret info, G-2. They way people say "What's the 411," is the same way military personnel might say "Give me the G-2".