Let’s look at the graph below:
Key Signatures can get tricky. Asking this question is like saying in math “why not have just a plus sign (+) instead of both a plus (+) and minus sign (-)”
Well, truth is, if a note goes up a half step it doesn’t become flat (unless its in a key signature). And saying that a key is in Bb (2 flats) isn’t the same as saying its in A# (3 sharps, and 5 double sharps). To call a single note two different titles is referred to as an Enharmonic
The key of D as 2 sharps (F# and C#), so you can’t say D has 2 flats (Gb and Db) because Bb has 2 flats (Bb and Eb)
The answer is inside the Intervallic Code: W W H W W W H (W stand for Whole Step, and H stands for Half Step) I made the H’s red so they stand out more.
No matter what Key Signature you start with, you must follow W W H W W W H in order to build a Major Scale. So to build C major it would be C D E F G A B (notice how it follow the Intervallic Code). The same goes for every other key such as D major, G major, Bb major, etc.
This code changes, though, when you build minor scales. Since minor scales start on the 6th note of the Key (i.e. ‘A’ in the key of ‘C’) then your Intervallic Code will also start on the 6th degree. So Instead of W W H W W W H, the new code would be W H W W H W W
Capistrano School actually has a great post on this, too.