The major scale can be harmonized, i.e. turned into chords. But, before we understand chords, we need to understand triads.

Triads are simple 3 note chords. The regular chords you strum on guitar are usually simple triads. The notes in the C major scale written out look like this:
We can follow a formula to build triads. Take the 1 note C and move up to the third note up from C to E. Then move up to the third note up from E to get G. Those 3 notes together C E G make up the C major triad. They are also the one chord in the key of C major. To simplify the idea further, what you’re basically doing is taking every second note and playing them together. To get the next chord in the key, i.e. the two chord, we do the same thing from the D note. The first note is D. Then we move up to the third note away from D and get F. Then move up to the third note up from F to get A. Those 3 notes together D F A make the D minor chord. We continue through every note in the C major scale until we get a total of 7 chords.

1 C major
2 D minor
3 E minor
4 F major
5 G major
6 A minor
7 B minor 7 b5 (This chord is often ignored)

Playing these chords randomly and then adding melodies from the C major scale, we end up with a full skill set to improvise in that key.

1 Major
2 minor
3 minor
4 Major
5 Major
6 minor
7 minor 7 b5

The chord pattern you see here is in every major key.

Below you can see the scale and chord relationship marked out on the fretboard diagrams. Notice how every single note in each chord fits perfectly into the scale. Notice also how a chord like D major doesn’t fit perfectly into the scale, so It’s not a chord in the key of C major.