Actually, I imagine the ninja clans would have been only too happy for people to believe they had magical powers - it made for good marketing. If you want to read some wonderful fiction set in a world in which the ninja actually do have supernatural powers, I recommend Lian Hearn's series Tales Of The Otori. But that's fantasy fiction.
But the stories were spread because they were very good at what they did do - espionage, arson, assassination, mercenary soldiering, etc. Their disguises were excellent. If they had spent all their time in those cool black costumes we imagine them wearing, they might have had trouble convincing anyone they were not spooky assassins!
In feudal Japan, you couldn't ask samurai, the equivalent of European knights, to go sneaking around spying and killing people without facing them "mano a mano". That was - tacky. Worse, it was dishonourable. So the daimyos, the lords, had to hire professional spies. If caught, they would die horribly, like the vile, dishonourable, loathsome creatures they were. But hey, it was a living!
There were two clans, from the Iga and Koga areas of Japan, who set up training in remote villages. A ninja - or shinobi as they're known within Japan, from a word meaning "hidden" - started training in childhood. They learned martial arts, of course, and did a lot of tough exercises, but also learned a regular occupation they could carry out while gathering information. Medicine was useful as an occupation, for obvious reasons. But there were plenty of others.
Not that there weren't security efforts going on. For example, there were the famous squeaky nightingale floors, so called because they "sang" when someone stepped on them. That would definitely get the attention of the guards. But what could you do when the ninja you wanted to avoid were actually living in the castle as sleeper agents? And while they couldn't actually walk through walls, as legend had it, there were plenty of crawl spaces for those who knew where they were.
And then there were ninja working for the lord of the castle. In the case of one siege, a ninja slipped out into the enemy camp and stole the banner. Next morning it was waving from the castle walls. Maybe it would have been more useful to simply kill the enemy leader, but that kind of psychological "Nyah, Nyah!" worked too.
In the 1400s there were around seventy ninja clans on Honshu, the main island of Japan. The leaders were jonin, the middle men the chunin, whose job was to arrange contracts with employers. The genin were the actual fighters, who often didn't know who their boss was, probably wise.
There were ninja working for just one noble family. The most famous ninja leader, Fuma Kotaro Noboyuki, was part of the Fuma clan who were working for the Hojo family. He lived in the sixteenth century and has become a part of Japanese folklore. Kotaro led a group of 200 ninja. Apart from the spying, he led them in a night attack on the Takeda forces. First, they faked an attack, sending in horsès with straw dummies as riders, while the real ninja smuggled themselves in. In the dark and confusion, the Takeda were doing the ninjas' job for them, killing each other instead of Kotaro's men.
I can imagine the enemy leaders crying out, "Oh, the cads! That is completely dishonourable!"
Sneaky but smart!
Tomorrow: O is for Odysseus!
Tomorrow: O is for Odysseus!