Well three of the many different versions anyway!
Legend of "Goutokuji" Temple (my favourite)
At the beginning of Edo period (17th century), there was a rundown temple in Setagaya, western part of Tokyo. The priest of the temple kept a pet cat , named Tama, and he sometimes complained to Tama about his poor situation, "Tama, I'm keeping you in spite of my poverty. So couldn't you do something for this temple? "
One day, Naotaka Ii who was the lord of Hikone district (western part of Japan near Kyoto) was caught a shower near the temple on his way home from hunting. While avoiding the rain under a big tree in front of the temple, Naotaka noticed that a cat was inviting him on the temple gate. And as soon as he left the tree tempted by the cat's gesture, the tree was struck by lighting. Naotaka's life was saved by the cat which was proved to be Tama.
By the incident, Naotaka became closer to the priest of the temple. The rundown temple was appointed to be the Ii's family temple, and changed it's name to Goutokuji. Goutokuji became prosperous backed up by the Ii clan after that. Tama saved Naotaka from lighting, and saved the temple from it's poverty at the same time.
After it's death, Tama was buried at Goutokuji's cat cemetery with all due respect, and Maneki Neko was invented admiring Tama.
Legend of Courtesan "Usugumo" in "Yhoshiwara"
During Edo period there were some amusement towns for men called Yuukaku which consisted of many entertaining houses in Japanese style, and one of the most famous towns was Yosiwara in eastern part of Tokyo. Roughly speaking, there were two kinds of women worked there to companion guests, one was a hostess professionally trained in traditional music and dancing called Geisha, and the other was a prostitute called Yuujo. And the supreme hostess for the super rich classes especially trained in various arts was called by an honorific title of Tayuu.
In the mid-Edo period (18th century), there was Tayuu in Yosiwara who was called by the name of Usugumo. She was well known as a lover of cats, and kept her cat by her side all of the time. One night, when she wanted to visit the toilet, her cat disturbed her pulling the hem of her skirt violently. Though she tired to chase it away, the cat did not stop the disturbance. Being terrified by its insistent action, Usugumo asked for help, and the owner of the house who rushed to her cut off the cats head by Japanese sword suspecting it was a goblin cat.
Then the cat's head flew to the ceiling of the toilet, bit and killed the large snake which was aiming at Usugumo there. The cat sacrificed its life betting its life to save its master. Usugumo mourned deeply over the mistake to kill her cat. To console her, one of her guests presented her the cats image in aromatic tree. The image of the loyal cat was the origin of Maneki Neko.
Legend of Old Woman in "Imado"
In the last part of Edo period (19th century), there was a old woman who lived in Imado, eastern part of Tokyo. Though she had kept a pet cat, her extreme poverty did not allow her to keep it any more.
So she told her cat, "I'm sorry I have to abandon you under this poor situation". On that night, the cat appeared in her dream and told her, "Please make my image in clay. It will surely bring a good luck to you". When the old woman made the cat's image in clay following to her dream, guest visited her wishing to buy it.
The more the old woman made the cat's images, the more guests visited her to buy them, and she could save money. The cat's image in clay which relieved her from poverty was the origin of Maneki Neko.