Diwali is celebrated on the no-moon day of Kartik. Bhagwan Mahaveera, the 24th Jain Tirthankara, attained Nirvana on this day at Pavapuri on Oct. 15, 527 BCE, on Chaturdashi of Kartika. The Lord discarded the body and the bondage of all Karmas on that night, at Pavapuri. In Uttara-puraana written by Acharya GunBhadra (7th or 8th century) it is mentioned that in the month of Kartika, krashna paksha, swati nakshatra and on the night of the 14th (dawn of the amavasya), lord Mahaveera became a Siddha (attained nirvana). After this first follower of bhagwan mahaveer, gautam swami attained kewal gyan.
कत्तिय-किण्हे चौदसिपच्चुसे सादिणामनक्खत्ते |
पवाए णयरिये एक्को विरेसरो सिद्धो ||
Diwali festival was first time mentioned in Harivamsha Purana written by Acharya Jinasena, and composed in the Shaka Samvat era in the year 705. Acharya Jinasena mentions that Bhagavan Mahaveera, attained nirvana at Pavapuri in the month of Kartika, Krashna paksh, during swati nakshatra, at the time of dawn. In Harivamsha-Purana 19th & 20th Shloka says that:
tatastuh lokah prativarsham-aadarat
samudyatah poojayitum jineshvaram
It means, the gods illuminated Pavanagari by lamps to mark the occasion. Since that time, the people of Bharat celebrate the famous festival of "Dipalika" to worship the Lord Mahaveera on the occasion of his nirvana.