The idea of Moscow being the Third Rome was popular since the early Russian Tsars. Its origins are traced to the rule of Ivan III . It had been crystallized in the famous prophecy of the monk Filofei (Philotheus) of Pskov addressing to Vasili III , the successor of Ivan III, in 1510.
According to the prophecy, there were to be only three Romes or in other words, centers of rightful religious faith. The first two have already fallen: Rome ("Old Rome") because of herecy and Constantinople ("Second Rome") because of Turks — leaving the only hope on Earth with Moscow ("Third Rome"), since, according to Filofei, ther would never be a fourth Rome.
Reference
Medieval Russia: A Source Book, 850-1700, transl. Basil Dmytryshyn, ed. Basil Dmystryshyn (Fort Worth, TX: Harcourt Brace Jovanovich, 1991), 259-261.