Hindu scriptures and mythology is the source of all the Hindu rituals and festivals. One can find explanations for all the Hindu traditions and customs in the religious Hindu epics. Therefore the origin of Rakhi celebrations is also rooted in the Hindu mythology.
There is no confirm date and time available about the history of Rakhi
festival but the story goes as follows...
In the Vedic period, on a 'Shravan Poornima' day (Full Moon Day of the
Hindu month of Shravan), the deities and the demons were fighting a
battle against each other. Unfortunately the demons were in a stronger
position as compared to the deities. The king of the deities, Lord
Indra, was very much worried about the result of the battle. His wife
Indrani (also known as Shashikala) could not see him worried and prayed
to the almighty. Indrani was a religious lady so she prepared a Talisman
with her religious power and tied it around Indra's right wrist. She
believed that this Talisman will safeguard Indra from the attack made by
the demons. She was actually right about her belief as that day the
deities won the battle and Lord Indra escaped unhurt.
As this Talisman had the power of protecting the one who holds it
therefore it was called 'Raksha Sutra' and the ceremony of tying
the Talisman was called 'Raksha Bandhan'. And since this
ceremony took place on 'Shravan Poornima' day therefore it has
become a tradition to celebrate 'Raksha Bandhan' on the 'Shravan
Poornima' day every year.