Kanji — the Japanese adaption of Chinese script — was the first script used to write Japanese. Kanji is very very similar to Chinese script, but unsurprisingly, the two scripts have diverged over the course of fourteen hundred years (or so). There are characters that are in Kanji but not in Chinese script, there are some whose meanings have diverged, Japan did not participate in the 1956 AD simplification of Chinese characters that the People’s Republic of China did, but the Japanese government periodically does change (usually simplifying) the approved orthography for Japanese.
By using the Chinese logograms, the Japanese set themselves up for a conundrum early on: how would they pronounce the characters? Should they pronounce them like the Chinese word for what they represent, or like the Japanese word?
English-speakers might have a similar conundrum when encountering the word “nation” in an English-language piece of writing about Quebec nationalism: is the italics for emphasis or because it is a foreign word? Should it be pronounced “NAY-shun” like in English or “nah-see-OHN” like in French? However, I had to work hard to come up with that example, while it is trivial to come up with examples in Japanese.
The vast majority of Kanji characters have (at least) two pronunciations, the Japanese (or “kun“) and the “Chinese” (or “on“) pronunciation. (To be more precise, as Wikipedia puts it, the “on” pronunciation is “the modern descendant of the Japanese approximation of the Chinese pronunciation of the character at the time it was introduced.”) Figuring out which pronunciation to use is based on what the surrounding words are, context, and personal judgment.
Links: Wikipedia, Ancient Scripts, Omniglot