More than three centuries ago the Russian capital was moved from Moscow to St. Petersburg, but then two centuries later the capital moved back to Moscow.
Russia has had several capitals throughout its history; six to be exact. This privileged status, however, has been held by Moscow and St. Petersburg for the longest periods. In the late 14th century, Moscow became a center of uniting Russian cities after the times of feudal fragmentation and fighting between grand dukes. In the 16th century, Ivan the Terrible named Moscow the capital of the Russian lands, and gave himself the title of tsar.
Moscow thus obtained an almost sacred status as the heart of Russian civilization. The Kremlin's cathedrals were the backdrop to the baptisms, coronations, and funerals of all the Russian tsars... until Peter the Great came to power in the late 17th century. He had German friends since childhood, and was a frequent guest in a German settlement next to Moscow.
Peter became a fan of the ascetic German lifestyle, and as time passed, he started to hate the excessive old court traditions, the lavish but bulky dresses, and the feasts where food was served on golden dishes. Peter went to Europe where he spent several years studying and learning the lifestyle of the locals, and returned an absolutely different man. So he decided to change his country according to his new knowledge - the old-fashioned Moscow didn't fit into his plans.
The Palace Bridge
Peter the Great wanted to build a new city in a European manner, with a certain urban plan (previously not used in chaotic Russian cities). Also, Peter invited European architects to erect very different buildings from what Russia had seen before. He even gave the new city a foreign name in the German style - Saint Petersburg, in honor of his saint patron, Peter.
The construction of the new city only started in 1703, but in 1712 Peter moved the capital there. In 1721, he proclaimed himself the emperor. Consequently, Russia became an empire with St. Petersburg as its capital city. Up until 1918 St. Petersburg was the capital of the Russian Empire and a symbol of its greatness. Nevertheless, during those years St. Petersburg was very different from the rest of the country, and not only in terms of architecture and city planning.
The Moika River
St. Petersburg became a city populated by foreigners and noblemen. French and German were more commonly spoken languages there than Russian. The city became a center of education and culture - ballet, music, literature, and fine arts. The most talented people from across the Empire, as well as from across Europe, flocked to St. Petersburg. They were enamored by the city's beauty, as well as the economic opportunity. Even Orthodox cathedrals in the city looked different from those in Moscow, as many were built in the Baroque style. To this very day, St. Petersburg is still called the 'Cultural Capital' of Russia.
St. Isaac's Cathedral
The city developed quickly and embraced all sorts of innovations; so, it's not surprising that revolutionaries appeared here. Starting in the second half of the 19th century, they committed terrorist attacks and even killed Emperor Alexander II. Workers started protesting against harsh work conditions and low salaries... and finally the revolution happened.
Just as Peter the Great once wanted to be rid of the old patriarchal tsardom, after the Bolsheviks seized power they immediately tried to erase the Imperial past. In one of their first measures, in 1918 they moved the capital of the new Soviet Russia to Moscow. This was primarily a propaganda decision: as you remember, the old city of Moscow was the cradle of the Russian nation, and was not associated with foreigners who were out of touch with ordinary Soviet people: peasants and workers.