It’s almost a cliché that Japanese has three writing systems, namely, hiragana, katakana, and kanji. Some people count romaji and say four. I have seen quite a few times questions like “how do you use the three writing systems differently?” on the internet and elsewhere. The truth is, Japanese doesn’t have three writing systems. It is a single writing system that makes use of multiple sets of characters. Although it entails some truth in it, it is pretty misleading to say that the language has multiple writing systems.
The Japanese language is written in a writing system called “kanji-kana-majiri,” literary, “kanji-kana-mixed” where “kana” stands for hiragana and katakana. As the name suggests, it is a single writing system composed of hiragana, katakana, and kanji. If I am to explain what it means by “mixed,” I would say that it is essentially the same as how English mixes the uppercases, the lowercases, and the Arabic (a.k.a., numerals). There are certain rules (or conventions) on in what cases the uppercases, the lowercases and the Arabic are used. To say that Japanese has multiple writing systems because it uses multiple sets of characters is as false as saying that English has three writing systems because it is written in the uppercases, the lowercases, and the Arabic.
In English, the uppercases are for the beginning of a sentence, the beginning of a proper nouns, emphasis, and so on. The numerals are substitutes for numerical words (one, two, three, four …) when the number is big, when calculations are involved, and so on. You could write everything in the lowercase letters if you want, but it is not considered as authentic or normal. It is just that following the conventions is not a legal obligations.
The same thing can be said for Japanese. Kanji is for certain things, hiragana is for certain things, and katakana is for certain things. Those are conventions. You could write everything in hiragana if you want, but it is not normal, and is done only for educational purposes. For the detail of the conventions, it is a little bit more convoluted than English.
First, there are certain kinds of words that are written completely in kanji. Those words are called kanji words. They are originally loan words from ancient Chinese, but since it has been a long time, they are put apart from katakana words, loan words from Western cultures. Kanji primarily represents meanings, or more precisely, morphemes taken from ancient Chinese. How they’re pronounced depends on the context. Although those loan morphemes are pronounced as Japanese approximations of the original pronunciations, thanks to the long history of the relation between China and Japan, the source language has not always been the same (the Chinese language is no exception of the universal truth that a language always changes, and a language has always some variations), which leads to multiple pronunciations of a single kanji character.
Speaking of katakana words, as it suggests, they’re written completely in katakana. Katakana is a set of characters that represents sounds or pronunciations. Since it purely represents sounds or pronunciations, it is used for representing foreign words. When you find the Japanese word sake in the Englishverse, you may find it confusing because it is spelled as the same as the English word. That happens because the roman letters are used in two different ways: one as a pure phonetic representation, and the other as a hard-coded sequence that represents a specific native English word. Katakana is in charge of the first role, leaving the second one to hiragana and kanji.
When hiragana and kanji represent a native word, they take a form of a specific sequence of them. Some native words are represented by a single kanji, taking the advantage of the fact that a single kanji character conveys a meaning. For example, “inu” is a native Japanese word for “dog,” and it is written as “犬”, a kanji that means “dog.”
Some other words are written in combination of kanji and hiragana. The vast majority of them are verbs and adjectives. For them, kanji are in charge of the stem, and the “grammar part” is written in hiragana. For example, “hashiru” is a native word for “run” and written as “走る” where the first character of them is kanji and the other one is hiragana. When the grammar part changes, such as when you want to say it in the past tense, only the hiragana part changes. The past tense of the verb is “hashitta” or “走った” where the first one is kanji (same) and the other two are hiragana. Notice that the first character is consistent with the present tense. That’s because it represents the verb stem. Imagine that in a parallel universe the British has gotten a lot of loan words from Chinese. They could write “I’m running” as “I’m 走ing.” What Japanese does is basically the same.
Some words are written completely in hiragana. Those words include grammar pieces, which probably parallel to words like “at” or “for,” a lot of common expressions including “ohayou” (good morning) or “arigatou” (thank you), which are written as “おはよう” and “ありがとう” respectively, and a small number of other native words. It is a common mistake to use too many kanji for common expressions. For example, a second language Japanese speakers tend to write “ありがとう” as “有難う” with two kanji in it, which is not wrong in the sense that you could still do if you really want, but it is uncommon and using too much of them is just awkward.
The vast majority of native words allow multiple ways of writing them. For example, “tanoshii” or “fun” is usually written as “楽しい” with one kanji and two hiragana, but you have some other choices if you feel like the commonest way doesn’t fit your feeling or the purpose of your writing. If you want you could write it completely in hiragana: “たのしい.” You can pick some less common kanji of the similar meaning for the word and write “愉しい.” The three representations are just different ways to write the same word, and the choice is a matter of preferences and the art of literature.
The saying that Japanese has three writing systems has long been there, and I don’t have knowledge on how this myth has been so widespread, but what it says is more of falseness than truth.