It does not tell us why pain exists
It does.
Pain exists to tell us when we should stop doing something.
Technically, it tells us that pain doesn't exist, and is just a electro/bio chemical reaction triggered by nerves*, which then releases other hormones and stuff in order to make that reaction not repeat itself again.
*Amongst other things, similair mechanics are also at work for Jealousy, for example.
Remember, anything that causes itself to happen again, happens again.
And as for laws of physics stopping to work all of a sudden, then we just break out some of the stranger theorems. Really, really wierd things happen if you leave mathematicians too long in a room without observationall input.
Points is, Science and Religion should be NOMA. However, humans kinda refuse to think in easily definable catagorems, and so both spill into it other, but more often into adjacent other things.
Science is a guide on how the Universe works. If the Universe decides not to conform, bad luck, start again.
The Bible, and any other religious work, is an attempt at describing a guide at how to create a more stable, and optionally better society*. Often by serving as an individual guidance for humans. This has been met with varying amounts of succes, partially because of the huge amounts of possible intrepretations.
*This ties in nicely with some theories on the origin of early religions. (Not all, mind you)