The definitive answer is lost in the mists of time, but here’s the most plausible explanation: Up until 1932 Switzerland’s country registration code was “CH” (for Confoederatio Helvetica, the Latin name for the Swiss Confederation).
Then, in 1934, the revised Paris Convention entered into effect, whose provisions included the stipulation that an aircraft’s registration must be identical to its radio call sign. The call signs for on-board radios had already been established in the Washington International Radiotelegraph Convention of 1927, under which Switzerland had been allocated the block of “HBA” to “HBZ”. So the later Paris Convention assigned Switzerland the “HB” country code for its aircraft registrations. Precisely why the 1927 Washington Conference had given Switzerland the “HBx” call signs is unknown.