I think about this a lot because I've had a scientific education and because I'm in church every Sunday, sing in the choir, give money on autopilot using an app, etc.
The Problem of Evil, that is, why does God let bad things happen, had been addressed many times by theologians of every faith you can think of. Human caused evil is the easy part if you accept that free will exists and is sanctioned by God. In the Christian context it has to be, because the concept of sin is incomprehensible otherwise. If we are not free to choose evil we are not free. If you are interested I wrote a series of humorous takes on this and other such theological conundra here:
https://medium.com/@quasimodo/list/b240411cc38a
The way I square the circle of scientific education and church participation is that I made a decision to become part of the Christian story, with all its warts, because of its underlying message of radical acceptance, which is different from the message of the world dominating religion of the "free" market. There you can never be good enough, never work hard enough, never be thin enough, never buy enough cool things, never have enough sex. If you are content with what you have you are a lazy good-for-nothing. Why are you not out striving to become your best self, whatever that might mean?
Christianity contains a better story, one where you are good enough even if you are a tax collector, a prostitute, or a Samaritan. So I choose that story. Yes, story. Stories are the most profound and powerful things we have. Like all our gifts of power, stories can serve good or evil ends. But we are creatures of story. Our stories make us human, so let me, let us, choose a good one. More here:
https://medium.com/illumination/how-to-believe-in-god-even-if-you-are-an-atheist-110fe05a119c