I mean it was right on the doorstep of their main rival Sweden. The worst thing your enemy can do to you is conquering your capital city so it seemed kinda counterproductive.
Russia lacked a warm(er) water port in which they could trade with other kingdoms/nations. Before Peter was able to seize Nyenskans, a fortress built by the Swedes in 1611, the only port that Russia heavily used was Arkhangelsk, which was neither attractive nor practical for international trade. Arkhangelsk was so cold, it shut down completely for long stretches of the year due to ice in the port.
By seizing a fortress on the Baltic Sea, Peter had two objectives:
Warm water port, with access to the important cities on the Baltic such as Gdansk/Danzig, Königsberg, Lübeck, etc.
Peter could build a "European" city akin to other capitals on the continent that weren't nearly as "Slavic" or "Eastern" in nature. It would look more like German, Austrian, French, or Dutch cities as opposed to Moscow, which had more of a Slavic/Eastern feel to it. It also would help usher Russia into the modern European Era and bring them to par with Prussia, Austria, France, and Britain. This was at the cost of Poland and Sweden, for better or for worse.
Peter brought in famous architects from all over Europe to help build St. Petersburg into a "European" city, complete with Baroque, Rococo, and neoclassical styles (Shvidkovskiĭ). Peter wanted St. Petersburg to be mentioned in the same breath as Amsterdam, Paris, Vienna, and so on.
Basically, these two reasons are why he made the city Russia's capital. It signalled a new, "modern", and "European" Russia, as opposed to the rather backwards, barbaric, and "Eastern" reputation that Russia had before his time.
Sources:
Robert K. Massie, Peter the Great: His Life and World
James Cracraft, The Revolution of Peter the Great
Dmitriĭ Olegovich Shvidkovskiĭ, St. Petersburg: Architecture of the Tsars