The city of Bergen was traditionally thought to have been founded by king Olav Kyrre, son of Harald Hardråde in 1070 AD, four years after the Viking Age ended with the Battle of Hastings. Modern research has, however, discovered that a trading settlement was already established during the 1020s or 1030s. Bergen gradually assumed the function of capital of Norway in the early 13th century, as the first city where a rudimentary central administration was established.

The city's cathedral was the site of the first royal coronation in Norway in the 1150s, and continued to host royal coronations throughout the 13th century. Bergenhus fortress dates from 1240s and guards the entrance to the harbour in Bergen.

Bergen was named Bjørgvin, "the green meadow among the mountains". It served as Norway's capital in the 13th century, and from the end of the 13th century became a bureau city of the Hanseatic League. Until 1789, Bergen enjoyed exclusive rights to mediate trade between Northern Norway and abroad and it was the largest city in Norway until the 1830s when it was surpassed by the capital, Oslo.

More Info: en.wikipedia.org