Why it's the capital
In 1191, after an earthquake hit their capital Shamakhi, the court of the Shirvanshahs moved to Baku. In 1918 Baku was proclaimed the capital of the Azerbaijan Democratic Republic, and in 1920 it became the capital of the Azerbaijan Soviet Socialist Republic.