As far as I understand Saint Petersburg was the capital of Russia at the time, not to mention it'd be easier to supply your forces along Baltic coast. What was Napoleon's rationale to go for Moscow then?
Because that's the way the Russian army was retreating. You might be interested on some of my previous answers on the Invasion of Russia, which you can find here and here.