"はひふへほ" had been pronounced like "pa pi pu pe po" until about 7th century.
That expains why "はひふへほ"(ha hi hu he ho) correspond to "ばびぶべぼ"(ba bi bu be bo).
(Phoenetically "h" doesn't have any relation with "b", but "p" does.)
Then they changed to "fa fi fu fe fo"--> "wa wi wu we wo"--> "wa i u e o" as the time going.
There were a lot of differences between the spelling and the pronouciation before the World War II. For example かほ(かお・顔)、まへ(まえ・前)、てふてふ(ちょうちょう・蝶々).
After the World War II, Japanese government decided to change the spelling consistent with the pronouciation. But the particles such as "~は","~へ" were so widely used that the change of spelling might cause confusion. So they decided to keep the original spelling in these cases.
That's why the particles were sometimes pronounced differently from the spelling.
And the "は" in "こんにちは" is one of the particles as others explained.