This post may contain affiliate links. We may earn money or products from the highlighted keywords or companies or banners mentioned in this post.

The sun had already begun dissolving into the reddening sea, an alarming reminder that we had dilly-dallied a little too long on our cycling jaunt round Japan’s Ninoshima Island in Hiroshima Bay. Unsure of the ferry’s last departure for the mainland, we stopped at a roadside bar to ask. This triggered worried looks all round: the final boat was about to leave.

“You can just make it if you take the shortcut,” said one man, stepping outside and pointing to a narrow road up a small mountain. With evening falling fast, we had severe misgivings, but cycled off uphill nonetheless. Looking round, we were astonished to see our newfound friend jogging up the hill behind us at a discreet distance to ensure that we didn’t get lost, only turning back when the port was safely in sight below us. His random act of kindness got us to the ferry with minutes to spare.

This was one of our first experiences with omotenashi, which is often translated as “Japanese hospitality”. In practice, it combines exquisite politeness with a desire to maintain harmony and avoid conflict.

Omotenashi is a way of life in Japan. People with colds wear surgical masks to avoid infecting others. Neighbours deliver gift-wrapped boxes of washing powder before beginning building work – a gesture to help clean your clothes from the dust that will inevitably fly about.

Staff in shops and restaurants greet you with a bow and a hearty irasshaimase (welcome). They put one hand under yours when giving you your change, to avoid dropping any coins. When you leave the shop, it’s not unusual for them to stand in the doorway bowing until you are out of sight.

Machines practice omotenashi, too. Taxi doors open automatically at your approach – and the uniformed white-gloved driver doesn’t expect a tip. Lifts apologise for keeping you waiting, and when you enter the bathroom the toilet seat springs to attention. Roadwork signs feature a cute picture of a bowing construction worker.

In Japanese culture, the farther outside one’s own group someone is, the greater the politeness shown to that person – which is why foreigners (gaijin – literally, “outside people”) are invariably astounded to find themselves accorded such lavish courtesies. “It still surprises me after nine years here,” said Spanish teacher Carmen Lagasca. “People bow when they sit next to you on the bus, then again when they get up. I’m always noticing something new.”

But omotenashi goes far beyond being nice to visitors; it permeates every level of daily life and is learned from a young age.

“Many of us grew up with a proverb,” said Noriko Kobayashi, head of inbound tourism at DiscoverLink Setouchi, a consortium that aims to create jobs, preserve local heritage and promote tourism in Onomichi, Hiroshima Prefecture. “It says that ‘After someone has done something nice for us, we should do something nice for the other person. But after someone has done something bad to us, we shouldn’t do something bad to the other person.’ I think these beliefs make us polite in our behaviour.”

So where did all this politeness come from? According to Isao Kumakura, professor emeritus at the research institute of Osaka’s National Museum of Ethnology, much of Japan’s etiquette originated in the formal rituals of the tea ceremony and martial arts. In fact, the word omotenashi, literally “spirit of service”, comes from the tea ceremony. The tea-ceremony host works hard to prepare the right atmosphere in which to entertain guests, choosing the most appropriate bowls, flowers and decoration without expecting anything in return. The guests, conscious of the host’s efforts, respond by showing an almost reverential gratitude. Both parties thus create an environment of harmony and respect, rooted in the belief that public good comes before private need.

Similarly, politeness and compassion were core values of Bushido (the Way of the Warrior), the ethical code of the samurai, the powerful military caste who were highly skilled in martial arts. This elaborate code, analogous to medieval chivalry, not only governed honour, discipline and morality, but also the right way of doing everything from bowing to serving tea. Its Zen-based precepts demanded mastery over one’s emotions, inner serenity and respect for others, enemies included. Bushido became the basis for the code of conduct for society in general.

The wonderful thing about being exposed to so much politeness is that it’s as contagious as measles. You soon find yourself acting more kindly, gently and civic-mindedly, handing in lost wallets to the police, smiling as you give way to other drivers, taking your litter home with you and never ever raising your voice (or blowing your nose) in public.

Wouldn’t it be great if each visitor took a little bit of omotenashi home with them and spread it around? The ripple effect could sweep the world.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.