
The original name came from the tribe of Britons who founded the fortress around which the city eventually grew. These Britons pre-date Roman times and spoke a form of Celtic. In this language the capital was called 'Dineidin' --- translated as 'fortress of the hill slope'.
The 'din' part of this Celtic name is eqivalent to both the Gaelic 'dun' (meaning fortress or castle) and the Old English 'burh'. Hence the two names of Dunedin and Edinburgh.
In the seventh century (638 AD) the city was captured by the powerful Northumbrians, whose influence and culture eventually resulted in the adoption of their Anglian speech and its development into what we call Scots. Although their King Edwin had been dead for six years when Edinburgh fell his name was long remembered and eventually became associated with the fortress that the Northumbrians now possessed.
In the twelfth century references can be found to 'Edwinesburg' and 'Edwinesburch' developed in the erroneous belief that Edwin had actually founded the fortress.
The grey area still seems to be whether the translation from Dunedin to Edinburgh came more through the change in language or more by the (false) association with Edwin.