People have been scared of the dark since before history, so it makes sense that legends have sprung up about creatures who only roam at night. From there it is easily imagined that sunlight could actually kill such monsters.
The typical foe who can be defeated by the light are of course vampires, but there are other creatures and characters that suffer the same weakness...