When the Japanese language was infused with the Kanji character system it also gained many Chinese words for concepts that either didn't exist or could not be articulated as elegantly as in the Chinese language.
Along with this character set came the pronunciation for the characters. Onyomi is characterized by its consonant-vowel-consonant structure. The word Peking(北京lit: north capital) is more appropriately spelled Pekin and demonstrates this structure.
The onyomi reading is usually used when two kanji characters are placed side by side with the exception of surnames, place names, and uniquely Japanese concepts.