The fear of the dark in stories can come from a combination of factors. Maybe it's the silence, the feeling of isolation, or the belief in supernatural beings that are thought to be active at night.
One reason could be that our minds fill the darkness with threats. Also, stories often use the dark to symbolize evil or mystery, which makes us scared.
Often, it's the unknown and the possibility of hidden dangers. We imagine all sorts of scary things lurking in the darkness.