The Sino-Korean vocabulary is from Chinese characters. They're essentially the same words, only pronounced differently. 漢字 is pronounced 한자 in the Korean way, "kanji" in the Japanese way. In other words, the sound for the Chinese character 漢 is "han" in Korean, and "kan" in Japanese. In fact, 산 used to be spelt 山 in Korean too, and still is, to some extent. But unlike Japanese, these days Korean usually uses the Hangul script to write Chinese origin words too.
Did they come from Japanese into Korean, from Korean into Japanese, or from a third language (presumably Chinese) into both Japanese and Korean?
Although most of the time, it's the Chinese vocabulary that has seeped into Korean and Japanese, the interaction is quite complex, and sometimes it's very hard to pinpoint where a particular word has come from. The Chinese Characters are definitely from China, there's no doubt about that, but Korean and Japanese has created their own vocabulary using these characters. 温泉(온천, Japanese onsen, Mandarin wēnquán) is definitely a Chinese-origin word, which has its roots in China, and has spread to Korea and Japan in an unknown way, presumably through Korea in the early days, and then directly to Japan later.
But things get complicated when it comes to words like 野菜(야채, Japanese yasai). This word, although it is composed of Chinese characters, does not exist in the Chinese language. It had never been used in Korean too, before the 20th century. In that time, this word was used only in Japanese. How did it magically appear in the Korean vocabulary then? The word 野菜 was made in Japan using Chinese characters, and then spread, in written form, during the Japanese occupation era of Korea(1910-1945), when people were forced to use the Japanese language.
It gets even more complicated in the word 人間(인간, Japanese ningen), meaning "human". This word does exist in Chinese vocabulary(Mandarin rénjiàn), but doesn't quite mean the same. It's meaning is originally "mortal world", as opposed to the heavenly world. This meaning stays the same in Chinese, and Korean until the 19th century. Japanese, however, altered the meaning to "human". That altered meaning spread to Korea during the aforementioned Japanese occupation, and became the primary definition of 인간.
Generally, there's no one way of how the words influenced each other in Korea, China, and Japan.