How did they adapt a foreign language writing system and use it for their own? Not easily.
Hanja and Chinese characters are logographic. Meaning, you can’t sound out the characters phonetically, as in Spanish, German, and English (sometimes).
Many Chinese characters derive from illustrations, like the Egyptian hieroglyphs. A brief sketch of a bird means bird. In this Chinese script, 山 means mountain.
Before the creation of Hangul, Koreans used Hanja in two ways. First, they used characters as is. Many of the elite could speak and write in Chinese.
However, the Korean language was created and existed parallel to Chinese. Koreans wanted to preserve their uniqueness. They weren’t Chinese. Their words sounded different.
So, the Korean elite decided to adapt Hanja characters o Korean phonetically.
If a Hanja symbol sounded like a Korean word, Koreans used the symbol to represent the Korean word.
Imagine banana was a Chinese word that meant, well, banana. And, imagine Korea had a word pronounced vamama, which means ‘tax refund’. Pre-Hangeul Korean’s might have written: