Less than two hundred years ago, Japan was under the rule of the samurai class. To be disrespectful of a samurai could easily and instantly cost your life. When a daimyo - a regional warlord – or one of his lords was travelling through an area, commoners in his path would fall to their knees and press their heads to the ground in respect – and fear.
Most authors these days attribute the politeness of today’s Japanese to the density of the population and other natural situations. More likely, it is the remnants of the days of the samurai.
Prior to the Meiji Restoration the class system was very strong. All of life bent to the system. There were four basic levels of society: the ruling Samurai class, the food providers – farmers and fishers, the artisans, and the merchants. This followed Confucian teaching; those who produced the necessities ranked highest, after of course the rulers. The merchants produced nothing and were considered parasites, making money from others work.
Butchers, leather workers, prostitutes, people handling the dead, etc., were not even in the system and were totally taboo. And aristocracy was above the system.
Scholars emphasized knowing one's place in the system. Confucianism taught "Doing one's duty in accordance with one's place in society" and the self is defined in terms of the others about the person. The self was unimportant - the group was everything.
The class structure led to standards of behavior. Four levels of language evolved - from casual language used among friends and within families to a high level court language. It is said that the first time the Emperor spoke by radio to the citizenry, few could understand his high level language.
Although the class system was abolished following the Meiji restoration, remnants remain. The most obvious is the use today of three levels of language among most people. Formal language is used when speaking to a person who is superior to the speaker, and informal when the roles are reversed. The third level is honorific, and is used when speaking to some very superior.
Who is superior? It is sometimes difficult to discern. One factor is age. As with most Asian countries, older people are respected, and thus are treated as superior. Customers are superior to store employees. Supervisors are superior to their subordinates. Teachers and parents are superior to their children.
Among equals, the degree to which the parties know each other is a factor – the more distance between them, the more formal the speech.
The formal language has more complex verb conjugation. Also, one does not omit obvious words as they might do in a less formal situations.
One aspect is the use of honorifics - today a person is addressed as (person) san, or sama or other terms depending on social rank.
In speech, different wording is used according to the level of language.
This, coupled with the need to deal with thee alphabets - kanji, hira gana, and kata kana, and occasional Romaji (Japanese words written with English letters) is one reason why many believe Japanese is a very difficult language.
On top of the complexity of Japanese language, every Japanese student learns English in middle school, although most do not learn spoken English very well, and most lose their English skill afterward due to lack of use.
When speaking formally, adding honorifics to nouns is appropriate. The letter o is an honorific applied to many nouns. For instance, one can speak of osake (sake), otera (temple), or ocha (tea). If the noun is of Chinese origin, go can be used as a prefix. Thus ,cooked rice is gohan.
Japanese avoid referring to themselves or others directly. This comes from the Confucian concept of self being a member of a group. The group is more.important. The self avoids drawing attention. There is a saying, “the nail that sticks up gets hammered”. So the words for I and you are used only when necessary.
An ancient superstition throughout Asia is avoidance of any reference to death. It shows up in numbers. Four is shi, which is the same word as death. And seven is shichi. To avoid speaking of death, the Japanese usually – but not always! –use yon for four and nana for seven. There are more substitutions among higher numbers.