PhD in music theory specializing in medieval theory here.
M. Cuthbert's answer here is correct, but I thought that I would add some missing details.
Heads up: this is going to be a long explanation, and it will take a while before we get to H.
tl;dr: B-natural and B-flat were both originally just called b but drawn squared off or rounded, respectively, and when the Western-style printing press was invented in Germany, the squared off b was replaced with an H because the original sets of type didn't have a squared off version of a b, only a rounded one.
Okay, here goes...
To oversimplify a bit (I will add some corrections at the end of this explanation), the original scale had only seven notes per octave, not twelve, over two octaves. We named them A B C D E F G in the lower octave and a b c d e f g in the higher octave. The top note of the higher octave was called aa (but the two letters were stacked on top of each other, which I can't easily type here).
In the early development of harmony in the Middle Ages, parallel organum was a favoured genre. In this genre, one part would sing the melody as written, and the other part would sing the same melody a constant distance lower — often a perfect fourth lower. This means that if you count backwards from the original note, such as E, you would have to count backwards four letter names (including the E itself) to reach the note that the second part would sing: EDCB; so, when the original part sings E, the second part sings B. If you follow this procedure all through the scale, the note four letter names below the original note is almost always a perfect fourth away. This creates a sound very similar to power chords on a guitar.
But for a fourth below a note to be a true perfect fourth, the note must also be five semitones below (1. E to E♭; 2. E♭ to D; 3. D to C♯; 4. C♯ to C; 5. C to B — a semitone is the space between any two directly adjacent notes on a keyboard, usually between one white key and one black key). However, the notes of a scale are not evenly spaced (there is no "black key" on the piano between B and C or between E and F, and the two white keys of each pair are a semitone apart). As a side effect, there is exactly one place where the fourth below a note in the scale is not a perfect fourth, and that is below b.
|Diatonic Fourth Below
|Number of Semitones
Notice that fourth note below b (which is F) is six semitones lower, rather than five. Today, we call this interval an augmented fourth (also called a tritone, because six semitones equal three tones [tri-tone = three-tone]). In the Middle Ages, one possible solution was to lower the b by one semitone, so that instead of being a wholetone above a and a semitone below c, it was a semitone above a and a wholetone below c. However, we couldn't permanently lower the b to that position because, as you can see in the chart above, the b in its original place is correctly five semitones below e. So, if we permanently lower the b by one semitone, now the fourth below e would become six semitones lower (a tritone). So, we have fixed one tritone by creating another.
The medieval solution was to agree that the note b had two possible positions. In order to distinguish between the two, medieval musicians would write the letter b in two different styles. In the usual, higher position (which is now called B-natural in the West), the ball at the bottom of the b would be drawn as a square, instead of a circle, and this note was called b-quadratus ("square b"), while in the lower position (which is now called B-flat in the West), the ball was drawn round and was called b-rotundus ("round b").
(Note that there is no fourth below the lower octave B, since there was no note that low in the mediaeval gamut, and it was not normal to have two positions for that B, just the usual position a semitone below C — although a medieval German theorist named Hermannus Contractus did use the lower position and drew it as a capital B in which the top loop was connected at the top but not closed at the middle; draw a b and an E in the same spot and you will have approximately the right symbol).
However, medieval musicians didn't just want to avoid the tritone harmonically. They also tried to avoid playing notes a tritone apart in close succession in the melody. So, if you have just sung round b (B-flat) in the melody and then quickly need to sing an e, you would also have to lower that e by a semitone to prevent the tritone. By the later Middle Ages, you would write this note on the staff in its usual place as an e, but write the b-rotundus letter-form in front of it to indicate that, like b-rotundus itself, this e note should likewise be lowered by one semitone. Alternatively, if you have just sung square b (B-natural) and then quickly need to sing an F, you would have to raise the F by a semitone to prevent the tritone. You would write this on the staff in the usual position for the F, but place a b-quadratus letter-form in front of it to indicate its higher position.
This practice is the origin of modern accidentals. In the round b, it is easy to see the origin of the flat sign (♭). Then, if you imagine a b with a squared-off lower end, but imagine that the vertical stroke on the right edge descends a little too far, you can see how the square b is the origin of the natural sign (♮). The sharp sign (♯) is a further development of the natural sign in which all of the strokes are drawn a little too long.
However, accidentals as we know them came later. Originally, square b and round b were the only notes that "properly" could have two positions. All the other possible alterations were called musica ficta or musica falsa (something like "fake notes") — they would be used, but they were not placed on equal footing with square b and round b.
This was still the status quo when the Western style of moveable-type printing press was developed in Germany in the fifteenth century. Here, I need to acknowledge that since we are now talking about the Renaissance, rather than the Middle Ages, I am stepping a little bit outside my area of expertise. So, I cannot say exactly who was the first to make the change to H (remember H, the original reason for this question?) or say with certainty why they chose the letter H specifically. But I can sketch it out in broad strokes.
The fundamental problem was that the original printing press required many little blocks to be carved into the shapes of each of the letters of the alphabet — and one would need a great many copies of each just to assemble a single page of type. The printing press was certainly not designed specifically for the very niche market of music theorists and their treatises. Any given set of type would have many little blocks carved into a b, but every b would look essentially the same. The set of type would not have a round b and a square b. At the time, a standard typeface for normal printing jobs would draw the b rounded off, not square (actually, in the original typeface, it would have been somewhere between square and round, but let that pass).
As an aside, I would mention that this problem has continued to plague music theorists right up to the present day. In most theoretical publications right up to the present, the square b is drawn rather than typed, and does not look like it belongs to the same typeface as the rest of the text (it looks like a stick figure). In recent years, it has become possible to draw a proper typographical square b by using custom fonts (I do this myself in my own papers), but it still causes problems with work submitted to publishers, who may not accept the use of the custom font. Other music theorists routinely just use ♭ for b-rotundus and ♮ for b-quadratus, since most publishers have access to these symbols (and I will do this throughout the rest of this explanation where it is helpful).
So, in the Renaissance, the simplest solution was to substitute a new letter for the square b, and that new letter was H. Why H? Well, according to the old folk etymology (which ignores the printing press altogether), it was said that H arose from some copyist's poor handwriting, of not quite closing the loop at the bottom of the b, so that it looked more like an h ( b ≅ h ). As the explanation above makes clear, this is not quite true, but it may be nearly true, insofar as the similarity between b and h (or ♮ and h, of ♮ and H, or ♯ and H, all of which have some degree of similarity) may have been the reason why the letter H was chosen for the printing press. Alternatively, it is also possible that H was selected simply because the seven notes already in use were the first seven letters of the alphabet and H was simply the next unused letter in the alphabet. (If there are any Renaissance musicologists out there who can point me to a source that settles this question, I would love to see it!)
All that is left, then, is to explain why the Germans, Scandinavians, and Eastern Europeans adopted this convention, while Western and Southern Europeans did not. This could be as simple as the very significant cultural divide between these two large regions of Europe. Loosely speaking, those that had once been part of the ancient Roman empire and spoke Romance languages — or, in the case of English, a language heavily influenced by Romance — are in the south and west of Europe and share certain important cultural similarities. Meanwhile, Germany, Austria, and the Scandinavian countries all speak Germanic languages and share certain cultural similarities. It is not surprising to historians when significant cultural differences break down along these lines.
I also wonder (but this is just sheer speculation — I have no evidence for this) whether Petrucci's invention of a music-specific printing press in the sixteenth century in Italy (part of the southern and western Europe block) might also explain why musicians in these countries might not have felt the need to come up with a new way to write b-quadratus, as music-specific symbols like ♮ and ♯ existed on Petrucci's press. (I would need to look through some Western Renaissance treatises printed on early printing presses to confirm this hypothesis — perhaps a Renaissance musicologist might be able to verify this?)
Originally, there were only seven notes, a–g, with two possible positions for b, with the higher position (B♮) drawn as a square b and the lower position (B♭) drawn as a round b. However, since this distinction was impractical on the printing press (developed in Germany), the square b (less generally useful outside of music) was replaced with the letter h, and this practice spread to other countries of Germanic persuasion, while it did not spread to the Romance countries of Southern and Western Europe.
Some other answers here have referred to the question of dur and moll, which are used to describe major and minor modes in Germanic and Eastern European languages (and molle is also used for flat in some languages). What is happening here is related to the concept of a hexachord, an early version of a scale. Since the placement of b was variable in the Middle Ages, an invariable structure of only six notes was used, called a hexachord. A hexachord has the structure tone-tone-semitone-tone-tone. The original form, now called the natural hexachord, was C-D-E-F-G-A — it avoids the B altogether in order to avoid specifying one position of B or the other. Later, a system of three hexachords came into being, each determined by the nature of the B in that hexachord: the natural hexachord, as noted, doesn't have a B; the "hard" (Latin durus) hexachord (G-a-♮-c-d-e) used b-quadratus; and the "soft" (Latin mollis) hexachord (F-G-a-♭-c-d) used b-rotundus. You could get a complete scale by shifting ("mutating") from one hexachord to another. In some languages, the name mol for the soft hexachord, which was the only hexachord that had a flat note, transferred to the concept of flat notes themselves. Also, since minor scales are marked by a low third and major scales are marked by a high third, minor scales became associated with softness (since the soft hexachord has the lower B-flat) and the major scales became associated with hardness (since the hard hexachord has the higher B-natural); think about what a scalar passage starting on G would be like in either the soft or hard tetrachords: in the soft hexachord, we would get the first half of the G minor scale, and in the hard hexachord, we would get the first half of the G major scale. So, soft = minor, hard = major.
Okay, I need to address a few oversimplifications.
Firstly, the original reason for the two possible positions of B probably predates the rise of parallel organum — and in fact, parallel organum at the fourth was usually designed to break out of strict parallelism to avoid the tritone, rather than using B-flats, though other treatises (such as the Scolic enchiriadis) do speak of notes outside the gamut arising in approximately this manner. Realistically, the origin of the two positions of b stem from the avoidance of the tritone melodically, but I find that people often find the harmonic explanation more intuitive (certainly, it is easier to hear when demonstrated on a piano), so I allowed myself a little license in my explanation.
At any rate, the concept of two positions for a note that corresponds to b already existed more than a thousand years earlier in ancient Greek music, the theory for which heavily influenced mediæval theory. Greek music was made up of tetrachords (tetra-chordos = four-string) which could either be joined together so that they shared one note at the place were they joined (E-F-G-a / a-♭-c-d) or spaced a tone apart (E-F-G-a / ♮-c-d-e), though they did not yet use letter names for notes. So, the equivalent to b-rotundus was in the synememnon ("joined together") tetrachord — and some mediæval theorists adopted the name synemmenon to refer specifically to the b-rotundus itself, rather than its home tetrachord — while the equivalent to b-quadrauts was in the diezeugmenon ("disjunct" or "separated") tetrachord.
Secondly, the use of ♭ and ♮ as "accidental signs" in the Middle Ages is a significant oversimplification. More accurately, they would be fa and mi signs, respectively. The hexachords described above were used to teach people to sing, and each note in the tetrachord had not only a letter name, but also a generic name based on its position in the tetrachord. This is the origin of the contemporary names do-re-mi-fa-sol-la-ti-do, except that ti (or si, as it is known in many languages) didn't exist yet, and do was, at that time, called ut. So, the pattern was ut-re-mi-fa-sol-la.
Since there was no ti/si, there was only one semitone, which appears between mi and fa. Consider where b occurs in the three tetrachord: in the natural hexachord, there is no b; in the soft hexachord, ♭ is fa — that is, there is a semitone below it and a tone above it; and in the hard hexachord, ♮ is mi — that is, there is a semitone above it and a tone below it. So, by extension, ♮ is the symbol not for a natural or sharp not, per se, no even necessarily for a raised note, but simply for mi, to clarify that there should be a tone below the note and a semitone above the note; exactly what pitch that note should be would be determined from context. In the same way, ♭ was not necessarily a symbol for a flat or lowered note, but merely a symbol to clarify that the note was fa, and had a semitone below it and a tone above it — the exact position of the note would be determined from context.
This explanation also highlights another issue I have largely ignored here: there was a significant difference between the ways that mediæval theorists thought about many of these ideas and the ways that mediæval singers understood and used them. This is a can of worms beyond the scope of this discussion here.
Thirdly, and along similar lines, the question of musica ficta is way more complex and controversial than I have described it here. Musicologists today argue about almost every aspect of musica ficta, including whether b-rotundus qualified as musica ficta (it probably didn't), and more interestingly, given that F-sharp would have been musica ficta, was it just the F-sharp itself that was musica ficta, or was it the entire tetrachord from which the F-sharp arises (including the more conventional notes D, E, G, a, and ♮) that are all collectively musica ficta in context? And, most importantly, does the term musica ficta properly apply to those occasions where such alterations were marked in the manuscript or to those occasions where singers intuitively made such alterations when they were not marked in the manuscript, or both?
Fourthly, as a fun observation and to clarify comment in another poster's answer above (which I suspect was meant to be a bit tongue in cheek), the availability of the letter H as a note does, indeed, make it possible to spell out the name BACH (the surname of a very large and influential family of German composers, not just the household name JS Bach) using musical notes — a fact used well by JS Bach himself and also by other composers in tribute to him — though this is certainly not the reason (pace IceQueen!) why the note name H came into being!
Finally, another quick reminder that my area of specialization is medieval theory, and especially in and around the eighth through eleventh centuries. The rise of H as a note name occurs long after that, and while I am better informed on that period than the average music enthusiast on the internet, I may be missing a few details here or there.