The modern B♭ trumpet descends from the natural trumpet, a valveless instrument limited to the notes of the harmonic series. The fundamental frequency of the natural trumpet is B♭, so the instrument was pitched in B♭.
When valves were added, they enabled chromatic playing, but the instrument retained its B♭ pitch. Modern B♭ trumpets are still tuned to this pitch.