Sankt Peterburg was a carefully conceived cosmopolitain European capital as opposed to the old medieval Moskva. It was built by Peter the Great who was deeply steeped in German and, particularly beloved by him, Dutch culture and technology. The name is the name of Peter's saint in Dutch. In Dutch it's pronounced a little differently but given that German is more widely known and German people were a large part of the community (and the royal family) the name of the city picked up the German pronunciation. It's not the only German name there. Lots of points of interest are named in German: Peter's personal palace = Peterhoff, curiosity museum = Kunstcamera, seaport town = Kronstadt.