There are many reasons why you need to be able to play equally well in every key. Bands often have to play in keys that suit their singer. That could be F# or Db for example. Keyboard players tend to like the keys of C, F and G, while E and A are fairly common keys for guitar.
Horn players like flat keys such as F, Bb and Eb. Apart from this, Jazz tunes often contain many key changes in themselves. For these reasons, you need to learn how keys relate to each other so you can move quickly between them.
One way to do this is to use the key cycle (also called the cycle of 5ths or cycle of 4ths). It contains the names of all the keys and is fairly easy to memorize.
Think of the key cycle like a clock. Just as there are 12 points on the clock, there are also 12 keys. C is at the top and contains no sharps or flats. Moving around clockwise you will find the next key is G, which contains one sharp (F#). The next key is D, which contains two sharps (F# and C#). Progressing further through the sharp keys each key contains an extra sharp, with the new sharp being the 7th note of the new key, and the others being any which were contained in the previous key. Therefore the key of A would automatically contain F# and C# which were in the key of D, plus G# which is the 7th note of the A major scale. When you get to F# (at 6 o’clock), the new sharp is called E# which is enharmonically the same as F. Remember that enharmonic means two different ways of writing the same note. Another example of enharmonic spelling would be F# and Gb This means that Gb could become the name of the key of F#. The key of F# contains six sharps, while the key of Gb contains six flats-all of which are exactly the same notes.
If you start at C again at the top of the cycle and go anti-clockwise you will progress through the flat keys. The key of F contains one flat (Bb), which then becomes the name of the next key around the cycle. In flat keys, the new flat is always the 4th degree of the new key. Continuing around the cycle, the key of Bbcontains two flats (Bb and Eb) and so on. Practice playing all the notes around the cycle both clockwise and anticlockwise. Once you can do this, play a major scale starting on each note of the cycle. In Jazz, there is a lot of movement around the cycle, so the more familiar you are with it, the better.