According to popular belief, they are assassins in feudal Japan. Historians who study the history of the island country can't really agree on exactly when the ninja community was created and who it consisted of. Since these people liked to be in the background and remain invisible to the current power, not much written material has survived about them.
The history of ninjas goes back to the distant past, to the world of legends. According to the chronicles, Jimmu, the first emperor of Japan, before his accession to the throne, sent two of his loyal servants to bring him clay from behind enemy lines in disguise. Then he offered the vessels made from it to the gods and finally led his armies to victory. Of course, these people did not call themselves ninja, but thanks to the strategy based on which they carried out their mission, we can rightly consider them as the first practitioners of ninjutsu with written memory.
In order to get a historically authentic picture, it is worth relying on the statements of a person who himself follows ninja traditions.
Based on the stories of Dr. Hatsumi Masaaki, the 34th Grandmaster of Togakure-ryu ninjutsu, ninjas were people who wanted to maintain their independence in the feudal Japanese society constrained by strict social norms, and who did their best to live in peace with their families, in harmony with the with nature.
From the age of myths, a long time had to pass before ninjutsu turned into a mature, well-defined system. It has been influenced by many over the centuries, and has incorporated all major technical and scientific innovations into its repertoire.
According to the current grand master of Togakure ryu, the first people who had a significant influence on the development of ninjutsu escaped during the Tang Dynasty due to war persecution, from the then territory of China to the forested and mountainous regions of Japan in order to live in peace. Among these refugees were many military leaders and churchmen who brought with them their experience and knowledge of warfare and spiritual teachings, which were outstanding in the age. Then they created ninjutsu by merging with the locals - who often also fled from the authorities to impassable regions.