Much of the history of the ninja is obscure due to the secrecy of the subject. Because of this they became the subject of folklore and it is difficult to separate fact from fiction. What are properly known as ninja appeared in the Sengoku or "warring states" period. They were the covert operations group of there day and were used for espionage, sabotage, and assassination.
They were often mercenaries hired to do jobs that the samurai would not. There were several ninja clans the most famous being the Iga and the Koga. Eventually, Oda Nobunaga invaded the Iga province the wiped out the clans with the survivors being absorbed into the Tokugawa Shogunate.
Ninja have appeared in Japanese folklore and fiction. Portrayals range from relatively realistic (Path of the Assassin) to the fantastic (Naruto) There first major appearance in Western pop culture was in the James Bond film You Only Live Twice.
In the 1980s, interest in ninjas boomed in America and the West. Several ninja movies staring Sho Kosugi were released and franchises like Teenage Mutant Ninja Turtles became popular. Many pre-existing characters were given ninja backgrounds like Batman, Wolverine, and Daredevil.
G. I. Joe/Cobra
Teenage Mutant Ninja Turtles/Foot Clan