Did the Japanese word originate in Chinese, or was it the other way around? Or are the two words related at all?
No, Japanese kawaii is not etymologically related to Chinese 「可愛」.
As a very simplified explanation, Japanese kawaii is a native Japanese word, originally coming from a contraction of kao (face, forming the kaw part of the word) and hayushi (flushed, forming the aii part of the word). The semantic extension is as follows:
flushed face > embarrassed > pitiable > lovable
The modern Japanese spelling 「可愛い」 is completely jukujikun (熟字訓); that is, none of the Chinese characters used here reflect any kind of etymology (Japanese or otherwise).
To reiterate, none of the morphemes which kawaii is composed of are Chinese in origin at all, but for the benefit of anyone who's studying Japanese and are aware of [the idea of kun'yomi], [Japanese spelling habits], and how it's a complete red herring to relate [kun'yomi words represented by Chinese characters] to [Chinese morphemes], the modern spelling of those Japanese words are:
- kawaii - 「可愛い」
- kao - 「顔」
- hayushi - 「映し」
They are unrelated.