A key gives music a tonal centre, the note that feels like home. A piece in C major uses mainly the notes of the C major scale and tends to resolve to a C major chord.
Major keys are commonly heard as bright and minor keys as darker or more serious, though context, tempo and arrangement matter just as much. Twelve major and twelve minor keys exist, and many songs change key along the way.
Knowing the key matters when you combine music with other material, such as a vocal or a second track. Clashing keys sound out of tune.
Using it in a prompt
Name a key ("in D minor") when the track has to match a singer’s range or another piece of music. For mood alone, "minor key" or "major key" is usually enough.