A recent Letter from Asia in the New York Times by Norimitsu Onishi entitled Japan and China: National Character Writ Large advances the proposition that the way in which Japanese writes foreign words reflects the strong separation that the inward-looking Japanese make between things foreign and things Japanese. Onishi writes:
Of all languages in the world, Japanese is the only one that has an entirely different set of written characters to express foreign words and names. Just seeing these characters automatically tells the Japanese that they are dealing with something or someone non-Japanese.Onishi contrasts the Japanese with the outward-looking Chinese, who have no special way of writing foreign words but create Chinese character spellings for them. He's right about the difference in national character, but I am doubtful of the relationship he suggests between national character and writing.
Japanese is written in a mixture of three sets of characters. One set consists of 漢字 [kanji] "Chinese characters". Most 漢字 are of Chinese origin, though as I've previously mentioned, there are some 国字 [kokuji] "national characters", which were created in Japan. The other two sets of characters are ひらがな [hiragana] and カタカナ [katakana], each of which by itself constitutes a basically phonological, moraic writing system. Except for certain details hiragana and katakana differ only in the shapes of the letters e.g. hiragana な vs. katakana ナ [na]. Japanese can in principle be written entirely in hiragana or entirely in katakana, though this is rarely done in practice. What Onishi refers to in the passage quoted is the fact that foreign words are usually written in katakana. This is true, but it isn't true that Japanese "has an entirely different set of written characters to express foreign words and names".
Historically, there is no association at all between katakana and foreign words. Originally, Japanese was written entirely in Chinese characters, where the characters were sometimes used for their meaning and sometimes for their sound. Not just any character could be used for its sound: for each syllable a certain set of characters could be used, up to about a dozen. This writing system is called 万葉仮名 [man'yoogana] "10,000 leaf kana", after the 万葉集 Man'yooshuu "collection of 10,000 leaves", the great anthology of poetry compiled in 752 C.E., which was written in this writing system. Over time, the redundant characters were eliminated, so that each syllable was represented by a single character, and the characters were simplified, which had the effect of differentiating them from Chinese characters. For instance, the katakana letter ナ [na] is a simplification of the Chinese character 奈.
This systematization and simplification of the 万葉仮名 took place twice, resulting in hiragana and katakana. hiragana came to be used particularly by women, katakana (together with Chinese characters) by men. Prior to the Second World War, katakana were routinely used to write native Japanese words. When European words first began to enter Japanese in the latter half of the sixteenth century, in many cases Chinese character spellings were created for them, as I've mentioned before. There was no special way of writing them.
Two relatively recent developments give rise to the impression that katakana are for writing foreign words. The earlier of the two is the shift away from maximizing the use of Chinese characters. This resulted in most of the old Chinese character spellings for European words being abandoned, and in the cessation of the creation of Chinese character spellings for newly introduced foreign words. The more recent of the two is the postwar shift to hiragana as the default phonological writing system. Together, these resulted in foreign words being written phonologically, and in the use of katakana becoming special.
Even if katakana were not developed for the purpose of writing foreign words, are they now used exclusively for this purpose? No. katakana are also used in a number of other situations:
So we see that even now katakana are by no means used exclusively for foreign words. The real principle at work is that hiragana is the default, while katakana is marked. When you want to mark something as special, you use katakana, rather like italics and scare quotes are used in English. The fact that Japanese usually write foreign words in the marked writing system may reflect a particularly intense interest in what is foreign and what is Japanese, but it isn't really very different from the English practice of writing words and expressions still perceived as foreign in italics, such as ad hoc and force majeure.