Until modern times science meant all sorts of knowledge, not just the geeky bits. And religion was the way pretty well everyone ordered their life. So it was all one thing.
Galileo was a practising Catholic, and senior clergy in the Vatican were on his side. The real worry was not about science but opening the door to Protestant thinking
Newton had a deep if unconventional faith, and wrote about that alongside gravity and mechanics.
Darwin did lose his faith for quite complex reasons, but also wrote, “It seems to me absurd to doubt that a man may be an ardent theist and an evolutionist.
The famous Huxley/Wilberforce debate about evolution didn’t have a clear “winner” nor was it much talked about at the time. The debate was between conservative and liberal faith.
The Huxley party wanted to professionalise science and separate it off from “amateurs” like clerics. (The term “scientist” in its modern sense was only coined in 1833.)
At the same time “fundamentalists” (their word for themselves) in America reacted by maintaining the literal truth of creation in 7 days with no evolution (“creationism” – not the same as believing in creation in the way I do).
There are some big issues to work through, but for many this is a “both-and” not an “either-or”. And scientists are as keen as the religious to recover good public discussion.