Why is the word オタク(otaku) written in katakana?
I thought only foreign words are written in katakana. Is this word maybe foreign after all? But it is used in Japanese, so I am confused. Please give me an answer.
In this case, katakana is used to indicate オタク is used not in its original sense but in its derivative sense. おたく was (and still is) an honorific expression used to refer to someone's family. So オタク was initially chosen to indicate you need to pay a special attention for interpreting this word. It's similar to enclosing a word with double quotes in English. Today オタク has become a word everyone knows, so it's safe to write it in hiragana, too.
This pattern is found in many technical terms. For example, のど usually means throat in everyday conversations, but ノド in the printing industry refers to an inner margin of a book.
There are many other reasons to use katakana instead of hiragana. See:
Yes, オタク comes from a Japanese word. From English Wikipedia:
Otaku is derived from a Japanese term for another person's house or family (お宅, otaku). This word is often used metaphorically, as an honorific second-person pronoun. In this usage, its literal translation is "you".
(...)
The modern slang form, which is distinguished from the older usage by being written only in hiragana (おたく), katakana (オタク or, less frequently, ヲタク) or rarely in rōmaji, first appeared in public discourse in the 1980s, through the work of humorist and essayist Akio Nakamori.
In addition to the transliteration of foreign words or writing words that would use rare kanji, katakana is often used to make the reader pay attention to some word that would normally be written in another way, creating the word a new meaning.
Another example of using katakana is referring to genitals as アレ ("down there") or ナニ ("you know what").