Take a major scale. A scale is a run of notes and a major scale has a certain pattern to the notes intervals (intervals being the space between two notes). So in the key of C a major scale would be:
C D E F G A B (C again so it sounds like we resolved the scale, don’t leave us hanging on that B)
Now take that scale and build a chord above each note with a third (interval) and another third. But only use notes from the scale. This means sometimes you will be using a major 3rd and sometimes a minor 3rd.
A major third, for example, is from G to B. Or C to E. They are a set distance away. C to Eb is a minor third. G to Bb is a minor third.
The point is you want to stay in the scale.
So the first note is C. A third above that will be...let’s see...skip the d, because that would be a second of some kind ...so E!
Ok, so now we have a C and and E and if played together they almost make a chord. By definition we need three notes played together to make a chord. So let’s go up a third from E and we skip F and get a G. Alright now we have
C E G and we get a major chord.
Do it again for D and we get D F A. Note that we didn’t use a F# (sharp) that would be a major third from D. Because F# is not in the scale of C. D F A is a minor chord. Listen to it.
If you continue to do this for the whole scale you will get a series of chords that are know as the diatonic chords. Which is a fancy way to say chords that are naturally in the key you are with no notes from outside the key.
Now to your question. Why would someone use a Bb chord of some sort in the key of C? Well...mainly because someone thought it sounded good. And there are more chords in the world than the ones from the key you are in. These are called borrowed chords meaning they are borrowed from a related scale. Perhaps the related minor scale, or another mode. In this case it is borrowed from C minor which will have a Bb major chord.