Why is the Scottish capital Edinburgh pronounced as Edinbruh?
Old English was not a single language spoken throughout Britain. It had several versions depending on the influence of the invader.
The word "burg" indicated a castle and was brought to the British Isles by those invaders from Norway to Northern Germany, all of whom had their own word, from a common origin, whose spelling and pronunciation was distinct but related.
Spelling was not formally standardised until the 18th century (and still is not complete).
The following spellings, up to and including Middle English, are from the OED. They should be pronounced in the accent of the time and region.
Forms: Old English burg, burug, Old English–Middle English burh, Middle English burch, bure(g)h, ( burehg), beriȝ, Middle English buruh, Middle English burrh ( Orm.), burwe, buri, Middle English burȝ, buruȝ, borh, borȝ, boruȝ, boru, Middle English burw, burȝe, borȝ(e, bourȝ, borou, borwȝ, borwgh, borw(e, borgh(e, Middle English burghe, Middle English–1500s (also Scottish 1600s–1800s) burgh, borogh, Middle English–1600s borowe, Middle English burwgh, borowgh, burwhe, borugh(e, burwe, bourg, Middle English–1500s bourgh, Middle English–1600s burrow(e, 1500s borrowe, ( bourg), burow, 1500s–1600s boroughe, 1500s–1700s burrough, (1600s burrowghe, 1700s borrough), 1500s– borough. dative singular Old English byrig, burge, Middle English birie, berie, Middle English biri, burie, buri.
You will note the irregularity of the "g" in "burg" - it varied immensely from the "x" in loch (/lɒx/), through modern j, hard 'g', soft 'g' a 'w' sound, a pure aspirant 'h', to completely silent.
The result of all of this was that, as few people could write - and those who could were taught in a similar manner - in the area of a place, the spelling would be the early phonetic pronunciation in that dialect/language.
It is thus to be assumed that the locals of Edinburgh, were among those who pronounced "burgh" as "br'".
The etymology is discussed at Wikipedia's entry for Edinburgh; (This is expanded upon at Etymology of Edinburgh)
"Edin", the root of the city's name, derives from Eidyn, the name for this region in Cumbric, the Brittonic Celtic language formerly spoken there. The name's meaning is unknown. The district of Eidyn is centred on the stronghold of Din Eidyn, the dun or hillfort of Eidyn. This stronghold is believed to have been located at Castle Rock, now the site of Edinburgh Castle. Eidyn was conquered by the Angles of Bernicia in the 7th century and later occupied by the Scots in the 10th century. As the language shifted to Northumbrian Old English, which evolved into Scots, the Brittonic din in Din Eidyn was replaced by burh, producing Edinburgh.
with the "gh" having the same value as in "through" but inserted to reproduce the earlier "burg" form.