There are lot of stories telling about the formation of Diwali. Below are some of them.
1. Return of Rama:-
The most famous legend behind the celebrations of diwali is about Return of Lord Sri Rama (Prince of Ayodya) to Ayodhya after Winning war with Ravana. Sri Ramachandra was staying in jungle for 14 years to full fill the promise his father has given to one of his wife. At that time The Devil king Ravana has kidnapped the Devi sita the wife of Rama. So Sri ramachandra conducted the war with help of monkey soldiers and won the war. He returned to Ayodhya with his wife Sita and younger brother Lakshmana after fourteen years. To Celebrate the joy of this occasion people of Ayodhya decorated their home with lamps to show the love and affection to their Price. So that day is celebrated as Diwali from there.
2. Incarnation of Goddess Lakshmi :-
People believe that Goddess Lakshmi (of wealth and prosperity), was incarnated On the auspicious new moon day, which is 'Amavasya' of the Hindi month of Kartik the. She appeared from the sea during the churning of the ocean, which is known as 'Samudra Manthan', by the demons on one side and 'Devataas' on the other side. Samudra manthan was done in order to extract 'amruth' which will help you to live for ever. People worship of Goddess Lakshmi, the Lakshmi Pujan, on the day of Diwali became a tradition.
3. Lord Krishna Destroyed Narakasura:-
Another story behind the celebrations of Diwali is about killing Narakasur the demon king ruler of Pragjyotishpur, in South of Nepal. He had a war with lord Indra the king of Heaven and defeated Lord indra. He snatched the Magnificent earrings of Indras mother aditi. Narakasura also imprisoned daughters of gods and saints. Lord indra was a relative of satybabhama (wife of lord Krishna). Lord Krishna defeated narakasura and released all women from his custody. People celebrated this occasion with decorating their house with Lamps placed all over.
4. Return of Pandavas:-
Kauravas cheated Pandavas on the game of dice and won. As a result pandavas had to go to forest for thirteen years and should abscond for one year. If Kauravas was able to identify them in absconding period they have to repeat another 3 years in Juncle. After succesfully completing this Pandavas returned to their country. People all over their Kingdom celebrated this occasion with lamps placed all over the house