At first, Japanese learned Chinese characters in order to read and write the Chinese language. Then, around the 6th century A.D., they began trying to use the Chinese writing system to represent their own language. This was a challenge because Chinese and Japanese belong to unrelated language families, so their sound systems, grammar, and vocabulary are completely different.
To understand how the Japanese met this challenge, we need to know a little bit about Chinese writing. In Chinese, each character represents a one-syllable word with a given pronunciation and meaning. Thus, for example, the character to the right represents a Chinese word pronounced "mao" that means "hair, down, fur."
To adapt this character to the Japanese language, the writer might decide to ignore its meaning and use it for its sound alone, that is, to let it stand for words or parts of words that sound like "mao" in Japanese. Or, he might decide to ignore its pronunciation and use the character only for its meaning, letting it stand for the word in Japanese that also means "hair, down, fur."
In fact, the first writers in Japan experimented with both ways of using Chinese characters to represent their language, and the writing system in use today evolved from these early efforts. Borrowing Chinese characters for their meaning gave rise to the modern use of kanji, and using Chinese characters for their sound gave rise to the kana syllabaries.