There are many stories associated with this festival. The most popular one goes like this:
When Krishna was playing on the banks of river Yamuna, his ball. got trapped in the branches of a nearby tree.
He fell into the river while climbing the tree to get the ball. In the river was apoisonous snake Kaaliya.The snake took this opportunity and attacked him. But Krishna fought bravely and would not give up.
After sometime the snake understood that this boy was not an ordinary child. Kaaliya then pleaded with Krishna not to kill him and Krishna spared him by taking a promise that Kaaliya would not harass people anymore.
Nag Panchami is celebrated as the victory of Krishna over Kaaliya, the most dangerous snake.