So what's a key?
A key is basically a group of notes (you play a note when you pluck one string on the guitar). Each key has a different group of notes. The key of D has one group of notes, the key of G has a different group of notes, etc.
Each key also has a group of chords. A chord is three or more notes played at the same time. Chords have names like "C Major" or "A minor". The chords in each key are made using the notes in each key.
When musicians make up a song, they pick a key and then "mainly" use notes and chords that belong to that key. So Hotel California by the Eagles (in the list above), mainly uses the notes and chords in the key of D. Imagine by John Lennon mainly uses the notes and chords in the key of C. For a more detailed explanation of notes, chords and the key concept click here.