The Japanese Tanabata Festival - which is traditionally celebrated on the Seventh Day of the Seventh Month according to the Lunar calendar - originates from the Chinese Qi Xi Festival, which in turn is based on the Chinese Folklore of the Princes and the Cowherd.
There are many variations of the story and here is the brief essence of one version:
Once there was a weaver princess named Orihime and a cow herder prince named Hikoboshi living in space. (The stars Altair & Vega). After they got together, they were playing all the time and forgot about their jobs. The heavenly king Tentei was angry at them and separated them on opposite sides of the AmanogawaRiver (Milky Way). The king allowed them to meet only once a year on the Seventh Day of the Seventh Month. (July 7th. according to the Gregorian Calendar or August 7th according to the lunar) This is why Tanabata is also known as the star festival. It's believed that Orihime and Hikoboshi can't see each other if July 7th is rainy, so people pray for good weather and also make wishes for themselves.