brian.koudijsさん、
As you know, katakana is often used for loanwords, but it does have a few other uses.
- Onomatopoeic words (of which there are a lot in Japanese) are often written in katakana.
- Some other things are often written in katakana, like the names of animals, e.g. サル - 'monkey'. This is especially true in scientific contexts.
- Katakana can be used similar to the way italics are used in English, to emphasise something in text.
- Some common words might be written in katakana - I think this feels more conversational (so, among other things, it's natural to use it when you're writing dialogues).
- In some contexts (e.g. manga), katakana is used to indicate that the speaker is speaking Japanese, but with an unusual accent.
- In graphic design, katakana is 'cool' and hiragana is 'cute', and the designer might decide between the two based only on that.
In the case of キレイ, I'd imagine it's simply because it's a common word (jisho.org actually does list the katakana as another form of the word, so it's probably about the word itself more than the context). You should generally stick with the hiragana in formal writing (it's rarely written in kanji), but the katakana is useful if you want to write in a more conversational tone.
小狼