What roused the Iga vs Koga (伊賀忍軍対甲賀忍軍; Iga Ninja Army vs Koga Ninja Army) rivalry in various fiction?
In Edo Period, storytelling features Iga and Koga as rivals due to their activity in the Tenshō Iga no Ran. While Iga and Koga aided Ieyasu's escape to Mikawa after Nobunaga Oda's death, there is an incident that the Koga were employed under Hideyoshi Toyotomi. Tokugawa and Totoyomi seemed to have had a proxy war, since the latter's primary hostilities was Akechi Mitsuhide and Oda Nobukatsu (Nobuo). Tokugawa primarily stayed on the defensive at Owari. The Koga were ordered to spy on Ieyasu Tokugawa; as the consequence, and considering the dangers of compromise, the Iga Ninja were assigned the mission to hunt down Koka Ninja.
Another possible reason was the alliance between the Oda and the Tokugawa, who fought in Omi Province.
In the 10th year of Tensho (1582年), from June to October, there was a war between called the Hojo and the Tokugawa camp called the Tensho Jingo no Ran (天正壬午の乱; Tensho Era Revolt of 10 years) disputing over the control of Kai, Shinano, and Ueno. This was after Nobunaga's death during the Honnoji Incident.
Much like the fictional depictions, it may trace back to Northern - South Court era. A rivalry is reflected in the teen years of Kyōshirō Kōsaka and Shōtarō Tsukimori; Yazaemon Kido and Zenjūbō Sugitani have a friendly rivalry, and are respectively called Yaza the Hawk and Zen the Dog (Hawk-Dog Duel). Kai Shimoyama, before the Iga Revolt, has accumulated resent from the Koga.
- YAHOO Q&A:伊賀忍者と甲賀忍者の違いを教えてくだされ。 (Japanese)