Before mahavir attained moksha what was the reason of celebrating diwali for jains
In Jain tradition, Diwali is celebrated to commemorate the nirvana (moksha) of Lord Mahavira. He attained kevala jnana and moksha on the Kartik Purnima day long ago, and since then Jains have kept Diwali as a remembrance of that event.
Before Mahavira’s moksha, there was no Jain festival called Diwali. The celebration began after his nirvana as a way to honor his spiritual liberation.
Note: Different Jain sects (Digambar and Svetambar) may emphasize slightly different details about the date and the event, but both traditions center Diwali on Mahavira’s moksha.