The major chord contains the 1st, 3rd, and 5th notes of a major scale. For example, below is a C major scale.
Notice that the octave (the 8th note) is also part of the chord. In fact, either of the notes C, E and G can be played in any octave on the guitar and it will still be called a C major chord.