Peking is not a western imperial name, its the chinese name, rendered in a way a 19th century british man thought a british person could approximate it
I thought it was a regional dialect thing due to sound changes since it was originally named (IIRC that would have been "Peiping/Beiping" at the time and the consonant in the middle just shifted back in the mouth and diverged regionally into either j or k because languages just kind of do that sometimes). "Peking" is the southern pronunciation and what western traders encountered first, while "Beijing" is the northern pronunciation (so the pronunciation in and around Beijing itself).
I thought it was a regional dialect thing due to sound changes since it was originally named (IIRC that would have been "Peiping/Beiping" at the time and the consonant in the middle just shifted back in the mouth and diverged regionally into either j or k because languages just kind of do that sometimes). "Peking" is the southern pronunciation and what western traders encountered first, while "Beijing" is the northern pronunciation (so the pronunciation in and around Beijing itself).