Well, part of his rationale was that Moscow was literally closer and easier to reach from the location he started the campaign. Additionally, even though Peter the Great had made St Petersburg the capital nearly a hundred years ago, Moscow was still the locus of Russian society and commerce in many ways. It was in many ways a more important target in any attempt to bring Russia to its knees (especially once one considers the propaganda value of seizing the spiritual capital of Russian Orthodoxy). Of additional note, it's interesting to remember that Napoleon seriously considered marching on St Petersburg after his conquest of Moscow, but the already extremely attenuated nature of his supply lines would have made any attempt to do so suicidal.
It was the Russian army that retreated to Moscow.
Napoleon followed it hoping to defeat it in a major battle.