As far as I understand it the Japanese Kanjis are derived from the Chinese ones. This was to introduce a writing system in Japan.
Way back in history Japan was a backwards island and Japanese leadership knew it. So they sent their best people to study / learn from Chinese society. They returned with knowledge about science, economics, etc. and a writing system (kanji).
"Onyomi" can be thought of as "the Chinese reading". Onyomi sounds typically are like しゃく、にゅう、しょ、みゃん, etc. which sounds like Chinese. Native Japanese sound beautiful: soft vowels, あ、い、う、え、お and consonants. This is "kunyomi".
Before scholars returned with their kanji / (onyomi sounds), kunyomi was the sound of the vernacular. That is why the names of people, places, traditions, etc. that are considered historically Japanese use kunyomi for their kanji (except the 4 main island names and 2 capitals cities: 本州, 東京 京都, etc. the reasons for this is explained later). A Japanese last name with some "on-yomi" reading is unusual and suggests that family "might" have some aristocratic lineage (this can be a great conversation starter. it would be a funny "complement" to say.) Only the elites / scholars would have known the writing system, thus would have known the "on-yomi" sounds to put in their last name.
Even to this day, in conversation, one might sound more scholarly by using "on-yomi" sounds in his / her speech. "みょうにち" instead of "あした" and "しゃしんき" instead of "カメラ", "さんぱつや" instead of "とこやさん", etc. While speaking with "on-yomi" is always understood, in most settings the "on-yomi" version of most words is not natural so it will probably get noticed.
Some words were introduced into Japanese only via the written language. Those words are Japanese, but they only have onyomi readings. Other than those, many kanjis have have both onyomi and kunyomi readings. And surprisingly some kanji only have kunyomi readings as well.
The Japanese writing system is obviously a mess. They imported words, and writing, from China in the past. They continue to import words from the West. But English and Chinese words / letters have no connection to Japanese grammar, so weird permutations to the Japanese language such as 送り仮名 、 サ変名詞 、美化語、振り仮名、etc. are needed to fit the imported words into Japanese grammar
But, all languages are "messy" and full of "loan words" from other languages.