The word belfry, believe it or not, originally had nothing to do with bells. Belfry is from the Old French berfroi, meaning a wooden siege tower. The word first appears in English c. 1300 as berfreyes. Over the years the meaning shifted from a siege tower to watch towers (which may or may not have had alarm bells), and then eventually to bell towers and church steeples. The spelling shift occurred by c. 1430 when the spelling belfreyes appeared. Eventually the new L spelling created an association with bells and the modern sense denoting a room in a tower where bells are hung dates to 1549.
Spelling shifts between L and R, as in berfreyes/belfry, are common in many languages, including English. The L and R sounds are formed almost identically, by raising the tip of the tongue close to the alveolar ridge, which contains the teeth. When pronouncing L, the tongue makes and maintains contact with the ridge; when sounding R, it comes close but does not touch. It is very easy to sound L when you mean R, and vice versa.
While we are on the subject of belfries, the phrase bats in the belfry is an Americanism dating to 1899. This phrase is the source of the sense of bats or batty meaning eccentric or insane, which both appear in the first decade of the 20th century. A belfry is a likely place to find bats and the phrase is simply a jocular expression similar to not playing with a full deck or his elevator does not run all the way to the top. In this case the belfry represents the head and brain and bats were chosen for alliterative purposes and because the creatures can be found there.
(Sources: Oxford English Dictionary, 2nd Edition; Historical Dictionary of American Slang)