To create the first chord of a scale use the first, third and fifth notes from any scale and play them at the same time. This example uses the D Major scale to create the D Major chord, but the technique works in every key. Find a scale you like (or try out a new one) and play the first three notes together. That's the first chord of that scale.
Of course, it works the other way around also. Once you have the chord you know which scale to play over the top of it, and any matching chords.