The C Major triad is made up using the standard formula for major triads. In this case the 1st 3rd and 5th notes from the major scale.
The notes in the C Major scale are
C D E F G A B C
Therefore taking the 1st 3rd and 5th notes from this scale gives the triad notes of C, E and G
Taking this one step further if you look at the first position C Major chord you have the following notes
5th String 3rd Fret = C
4th String 2nd Fret = E
3rd String open = G
2nd String 1st Fret = C
1st String open = E
So you can see that the open chord fingering doubles up on the C and the E notes but keeps within the triad note structure.
This theory blog is currently being replaced with a structured theory section. In the meantime you might find some duplication so apologies in advance for that.