The two sites are talking about two different things.
The letters are being used as note names.
The letters are being used as chord names.
The first site is using the numbers to specify which notes of the scale are included in the chord. So, given notes 1-3-5 of the C major scale, those are C E G, which gives you a C major chord.
The second site is using the numbers to specify which is the starting
note of the chord. So, in the C major scale, start on note 1 and build a triad. The notes are C E G. That's a C major chord. Start on note 3 and build a triad. The notes are E G B. That's an E minor chord. Start on note 5 and build a triad. The notes are G B D. That's a G major chord. In shorthand: start on note 1, C. Start on note 3, Em. Start on note 5, G.
The second site points out the pattern for starting on each note of the major scale in turn and building a triad. In the C major scale, you get the chords C Dm Em F G Am Bdim, which gives you the pattern M m m M M m dim corresponding to starting on notes 1 2 3 4 5 6 7 in turn.
I thought the chord formula for a major chord is M m m M M m o M like the second site says, if so shouldn't C Em G be the right 1-3-5 ?
M m m M M m o M is not the formula for a major chord. It is the pattern for triads built on successive notes of a major scale. Three are major triads, three are minor triads, and one is a diminished triad. The letters M and m refer to the type of CHORD: major or minor.
The formula for a major chord, if you want to use this language, is M m, where the letters stand for the type of THIRD: major or minor. A major triad in root position is a major third and a minor third stacked on top of each other.