The origin lies in the Ramayana account of Rama's victory over Ravana and the Devi Mahatmya account of Durga's victory over Mahishasura.
In the Ramayana, Lord Rama slew Ravana on this day, rescuing Goddess Sita after a long exile and war. The day also marks Goddess Durga's victory over Mahishasura on Vijayadashami.
Valmiki Ramayana; Devi Mahatmya