The Japanese word Mushi 虫 is used in modern Japanese to refer to bugs, and is the word used for the Pokemon's Bug-type.
However, the word was also used to describe a certain Taoist concept that started in Chine, then spread to Japanese nobility in the Heian Period, and to the rest of the population during the Edo Period.
This concept is known as either the Three Worms (三虫 Sanchuu) or the Three Corpses (三尸 Sanshi). These are three spiritual creatures that reside in the body of every person, recording all evil acts they commit.
It was said that every 60 days, on the day of Koushin 庚申 using the Chinese calender, the Mushi would leave your body in your sleep to report your evil deeds to the heavens. The heavens would then shorten your lifespan as punishment. Because of this, there was a tradition in Japan called the Koushin Wait (庚申待 Koushin-Machi), in which people would celebrate throughout the day and night to keep themselves awake.
It's from this believe that several modern Japanese phrases come from. For example.
Warning from bugs (虫の知らせ mushi no shirase) - A feeling of premonition that something bad is going to happen. Notably, this is the Japanese name for the Pokemon ability Swarm
The bugs are in a bad place (虫の居所が悪い mushi no idokoro ga warui) - Body feels bad. It was said that if the mushi in your body didn't calm down, you'd get sick.
The bugs don't like them (虫が好かない mushi ga sukanai) - Someone is unlikable
Stomach bugs (腹の虫 hara no mushi) - One's mood
From this we can think of a few things.
Bug > Dark = The believe in mushi reporting evil deeds
Bug > Psychic = The mushi were said to mess with your mood and feelings, and in Japanese believe one in particular was said to live in your head and mess with it.
Ghost and Fairy resistant to Bug = The spiritual and magical beings have more protection against the mushi than regular living creatures.