Broadly speaking, major chords sound bright and happy. Minor chords sound dark and sad.
The C major scale consists of C-D-E-F-G-A-B-C. The A-minor scale consists of A-B-C-D-E-F-G-A. Those are the same notes, but if you play each of those patterns on a keyboard, the first one sounds happy, the second one sounds sad.
A C-major chord (technically, triad) is made up of C-E-G, the first, third, and fifth notes of the scale. Again, sounds happy. The A-minor triad is A-C-E ... sad.
But if you play a melody -- that is, one note at at a time -- it isn't always clear whether it's happy or sad. In most western music, though (including virtually all pre-1900 classical music and the vast majority of modern pop), the piece will end ("resolve") with a clearer "happy" or "sad" type of chord. That final chord is what determines the key.
(In a huge amount of classical and popular music, the final chord is the same as the opening chord, but not always. When they're different, the final chord tells you the key.)
The C major scale consists of C-D-E-F-G-A-B-C. The A-minor scale consists of A-B-C-D-E-F-G-A. Those are the same notes, but if you play each of those patterns on a keyboard, the first one sounds happy, the second one sounds sad.
A C-major chord (technically, triad) is made up of C-E-G, the first, third, and fifth notes of the scale. Again, sounds happy. The A-minor triad is A-C-E ... sad.
But if you play a melody -- that is, one note at at a time -- it isn't always clear whether it's happy or sad. In most western music, though (including virtually all pre-1900 classical music and the vast majority of modern pop), the piece will end ("resolve") with a clearer "happy" or "sad" type of chord. That final chord is what determines the key.
(In a huge amount of classical and popular music, the final chord is the same as the opening chord, but not always. When they're different, the final chord tells you the key.)