It is natural for dogs to be afraid of loud noises.
The sounds trigger their nervous systems, and they can become anxious or afraid.
Running away from the noise is a survival instinct.
Remember, to your dog, the experience of fireworks is different than other natural loud noises, like thunder.