Some of the basic ideas behind the development of ninjutsu came to Japan from China, but like much else in Japanese culture which stems from foreign sources of influence, ninjutsu quickly became Japanized. In Chinese military classics such as Sonshi 's (Sun-Tzu in Chinese) Art of War can be found descriptions of methods of espionage. The Art of War was known in Japan as early as the sixth century A.D.
The Art of War is a guide for military commanders that is still considered essential reading for modern military officers, as well as business people. One part of the text in particular caused changes in the philosophy of Japanese warriors that would eventually lead to the ideology of the ninja. Chapter 13 (translated text) describes the advantages that can be gained by spreading disinformation amongst your enemies, and sowing confusion in their ranks through deception and sabotage. It also recommends that generals find out as much as possible about their enemy by using spies and other practical methods.
Much of this was antithetical to the Japanese way of waging war. For centuries, armies of foot soldiers and samurai would line up and call each other out to do honorable, one-on-one battle. The underhanded tactics espoused by Sun-Tzu went against the grain. But the wisdom of using deception and espionage to win wars could not be denied, and many Japanese warriors came to grudgingly accept it.
In the seventh century a considerable number of persons wanted for various reasons by the Imperial Court had taken refuge in the mountainous wilds of Iga and Koga near Kyoto. They were greatly outnumbered by the government warriors sent out to disperse them, and therefore it became necessary for them to develop clever tactics and strategy to guarantee their survival.
The regions of Iga and Koga in Japan are considered by many to be the birthplace of the ninja as a major force in Japanese warfare. The men who belonged to the clans that ruled the area hired themselves out as mercenaries, fighting for whichever daimyo, or lord, paid them the most. The Iga and Koga ninja often worked for daimyo that they had been hired to attack just a few years earlier. This reputation as disloyal mercenaries became a trademark of the ninja, running in direct opposition to the bushido code of the utterly loyal samurai.
Ninja were born and trained in families devoted to the study and practice of ninjutsu as their profession. Each ninja family was dedicated to a specific tradition (ryu) that characterized it's particular brand of espionage and assassination methods. Over time, some seventy different ninjutsu traditions were developed, the most famous of which belonging to the Iga and Koga regions on the main island of Honshu.
The ninja clans were found scattered throughout the country, however, their distribution in part due to the fractionation of the older and more organized traditions.
Because individual ninja became attached to and supported different political causes it was possible for father to operate against son, and brother against brother, each the hire of some very influential land baron who required the services of military spies. But no one ninjutsu organization ever became powerful enough to withstand the onslaught of the combined forces of the shogun's government.