Kappas, kitsune and gods of all origins exist in Natsume's Book of Friends -- yet despite the plethora of mystical beings that Natsume Takashi has encountered during his adventures in the series, the most powerful and mysterious may just be the small, unassuming cat riding on his shoulder that could devour him in a single bite.
Natsume's Book of Friends is the story of the teenager Natsume, who has always had the ability to see Japanese beings of myth called yokai, causing him no end of misery. However, everything about Natsume's life changes when he finds the Book of Friends -- a collection of the names of local yokai his grandmother Reiko had once collected -- and accidentally frees a powerful yokai named Madara that had been trapped in a shrine for years. This yokai desires the Book of Friends for himself but makes a deal to inherit the book when Natsume dies. Until then, he will accompany Natsume to make sure no other yokai dares encroach on his territory. Thus, a friendship is formed between boy and yokai, and Madara takes the shape of a cat so he can live with Natsume, assuming the name 'Nyanko-sensei.'
But just what is Nyanko-sensei and why is he such a valuable ally? Dog-shaped yokai such as him are known as inugami and have been featured in other popular Japanese media such as Inuyasha. There are many differing folktales about how an inugami comes to be. Some people brought inugami upon themselves by killing a dog and being purposefully possessed by its spirit for luck. Other tales claimed that inugami were the scattered remains of beasts slaughtered by famous warriors and had transformed into new creatures. Still others said that inugami came forth from paintings or stones.
Although legends of inugami exist in Kyushu, where Natsume's Book of Friends takes place, there are no legends specific to that area regarding inugami or leads to which legends Kyushu would have used, so Madara remains a mystery in many ways. He most likely was not the product of human possession due to having his own material body, and his level of power would suggest a grand origin, so he is most likely a yokai born from a famous painting or stone, or else from the remains of an even greater spirit.
As an inugami, Madara would be broadly classified as 'dōbutsu no ke,' meaning an animal spirit, and he is also an obake, meaning he can shape-shift. His time imprisoned in the shrine seems to have imprinted on him, as Madara's form of going undercover is to assume the form of a lucky cat. Despite taking on this minuscule appearance, as soon as Nyanko-sensei transforms into Madara, it is usually enough to scare any interfering yokai away. This reveals that Madara is capable of hiding his presence quite effectively, let alone how intimidating he is when he shows his true form.
Besides shapeshifting and flight, Madara is able to offer spiritual help and protection, as well as being an endless source of knowledge, so despite his nights rolling around Natsume's room with a bottle of sake, Nyanko-sensei is easily the most powerful and likely most knowledgable being on the show, even if he never actually admits it.
Nyanko-sensei is a shady character at the beginning, yet he quickly becomes essential to the show, and not just because of his power. Despite griping about how he wants to eat Natsume, he never takes advantage of any chance he has, even if he dismisses it as the agreement he has to inherit the Book of Friends when Natsume dies. Given that he actively saves Natsume's life multiple times, he seems content to wait.
Perhaps it's simply that an inugami has a long life and the wait doesn't seem long, or perhaps it's that he's grown fond of this human. If Madara was born when the great myths such as Tamamo-no-Mae were still around, he has been alive for thousands of years, and his motives for not snatching up the Book of Friends can be as simple and relatable as loneliness. Whatever his reasons and mysterious origin, Nyanko-sensei has remained a faithful sidekick thus far and the first true companion Natsume was able to welcome into his life, making him an indispensable part of Natsume's mission to return all the names in the Book of Friends.
Natsume's Book of Friends can be streamed on Crunchyroll and Funimation.