China was culturally very dominant in East Asia, and so educated people in Japan learned the Chinese script when writing first came to Japan. Eventually, Japanese people wanted to write in Japanese, but unfortunately, the Chinese script was not well suited for the Japanese language. In spoken Chinese, there aren’t a lot of meaningful grammatical variants of words, while in Japanese (like English), there are.
To make a rough analogy with English, it was as if we tried to write “slaughtered goats smell after three days” with a writing system that only had single characters for “slaughter”/”slaughtered”/”slaughtering”, “goat”/”goats”, and “smell”/”smelly”. Your sentence could be interpreted as “slaughter the smelly goat in three days”. This kind of ambiguity would be bad in legal documents or warning signs!
To deal with that, Japanese co-opted some Chinese characters for use as syllables, and would tack them on to the Chinese characters to modify them. (We do this to a slight extent in English, tacking on phonetic endings to logograms for numbers, e.g. “1st”, “2nd”, etc.) This secondary script was called Manyogana, and while it was perhaps better, it was confusing in a different way: when reading, you sometimes couldn’t tell if a glyph represented a word or if it represented the sound of a syllable.
There were also different glyphs used for the same sound. In some cases, the sounds might have been distinct in the past but are no longer distinct, but it is clear that in some cases, different people just chose glyphs from different homophones. (In English, it would be as if one person used the glyph for “two” and another used the glyph for “too”.)
Thus, Manyogana was not an ideal script for Japanese.