Peking is pronounced like its written bc its not mandarin beijing for northern capital but cantonese for northern capital.
The world used cantonese before mandarin for few reasons and depending on words. Cantonese was a much larger community overseas so they taught foreigners cantonese words. The other reason for some words is that cantonese is closer to the ancient chinese than mandarin, so some words when they are far back transferred to the west and middle east sound closer to cantonese
While all that is true, it leaves out the history of transcribing Chinese into English. Until pinyin was introduced in the '70s, Mandarin transcriptions also used the "pe" transcription.