A key has two parts: a tonic (the home note) and a mode (usually major or minor). 'G major' means the music feels resolved on G and uses the G major scale.
Knowing the key tells you which notes and chords belong (diatonic) and which feel like outsiders. The Circle of Fifths organizes all 24 keys (12 major + 12 minor) by how closely related they are.