Like the story of Kagua Hime or the Adventures of Monkey which respectively influenced Sailor Moon and Dragon Ball, the old Japanese folktale of Jiraiya Goketsu Monogatari (The Tale of the Gallant Jiraiya) has influenced several stories and characters in anime and manga.
Remember the three legendary Ninjas of Jiraiya, Orochimaru, and Tsusande in Naruto? Their names and their powers of toad, snake, and snail magic are pulled from this story. In this folktale, Tsusande and Jiraiya were married when they were attacked by their one time friend Orochimaru. Orochimaru had fallen under the influence of snake magic.
Kishimoto wove this folk-tale into Naruto brilliantly. Like Kagua Hime or the Adventures of Monkey, he's given this Japanese folk-tale of Jiraiya new life and has shared it with millions of people across the world.
As a side note, Orochimaru in Naruto has another power of pulling a sword out of this mouth. In Japanese Myth, this sword is called the Kusanagi-no-Tsurugi (Grasscutter Sword).
The Japanese god Susanoo found this sword in the body of the eight-tailed and head serpent called Yamata no Orochi he slew to protect a Shinto God's daughter. If the name Susanoo sounds familiar, it's the third ability Sasuke uses with the Mangekyō Sharingan.