Science made the knowledge that you describe possible in two ways.
First and foremost, science is a way of thinking. It is based on observation rather than on theories. It is based on looking at the evidence and trying to create theories that fit that evidence. This is in contrast to older ways in which theories were held to be true and evidence to the contrary was ignored or explained away (as in the attempts of ancient thinkers to explain the fact that the movement of the planets did not fit with the idea that they orbited the Earth). When people started to think scientifically, they started paying more attention to what they observed and that eventually led to them realizing that the Earth orbited the Sun.
Second, science is about technology that allows measurement and observation. Technology allowed the heliocentric theory to be confirmed. This is because Galileo's creation of a good telescope allowed him to accurately observe and track the movements of various heavenly bodies.
So science allowed us to learn these things because it created the tools and (just as importantly) the way of thinking that allowed for these discoveries.