This is a common confusion. It supposes that there exist two things in contradiction when there are really four things to consider. As you have presented it here the two things are:
1. God's revelation in scripture
2. Human understanding of God's creation.
If one interprets the creation accounts in scripture as reportage (i.e. a straightforward unadorned chronology of what happened when God created the universe), yes that contradicts what science has learned about the origin of the universe and its components.
But this does not mean that science contradicts God's Word.
This is because we need to take into account the other two realities as well, namely:
3. God's revelation in creation
4. Human understanding of scripture.
Now, we can agree that human understanding of God's creation is limited and fallible. What needs to be emphasized here is that human understanding of God's revelation in scripture is also limited and fallible. Would you agree?
And since all of us read scripture in light of our own limited and fallible understanding of scripture, it is incorrect to say that our human understanding of creation is out of step with scripture. Not unless we can guarantee that our human limited and fallible understanding of scripture is correct.
Where human understanding of creation is incorrect, yes, it is in disagreement with God's word. But it is also true that where human understanding of scripture is incorrect, that is also in disagreement with God's word.
By the same token, when our human understanding of creation and/or scripture is correct then it does not contradict God's Word. But remember that our understanding of scripture is just as likely to be wrong as our understanding of creation. And our understanding of creation is just as likely to be right as our understanding of scripture. So when one seems to contradict the other, we cannot assume that it is our understanding of creation that is wrong, while our understanding of scripture is right. It could just as easily be the other way around. So we need to scrutinize both to find where our error lies.
To sum up: we have two revelations from God.
1.God's revelation in creation (often called 'general revelation' for it is given to all humanity of every nation and belief).
2. God's revelation in scripture (often called 'special revelation' for it was given to those chosen to receive it.)
These two revelations are different in nature and purpose, but do overlap to some extent. Since both come from God, both are true and cannot contradict each other.
We also have the human side of both of these revelations. For our finiteness, and the limitations on our knowledge, and our ability to be misled in both sense and reason, means we do not receive either revelation in its pure form, but through the filter of our finite and fallible minds and spirits. So we have:
3. our human understanding of God's creation
4. our human understanding of scripture
Here is where error can occur. And as a consequence here is where the conflict lies. And as we come to better understanding of one or both, the conflict is also resolved.
As I see it, the inerrancy of scripture is a useless belief. Even if scripture is inerrant, it doesn't help unless we can guarantee that we can understand it without error. And being human we cannot. We don't even have to bring science into the picture to see that. For there are innummerable things that different Christian denominations disagree on that are based solely in scripture, and they cannot all be right.
But so far as science (human understanding of God's creation) is concerned, we should not assume that because it conflicts with our understanding of scripture it is therefore in conflict with God's word. It is just as likely--and where the science is very probable, even more likely--that the conflict is with a human and erroneous understanding of scripture. As you say, God understands his own creation. And if God tells us through his creation that it is very old (and we are quite sure that this is the message of nature), then it is incorrect to interpret scripture as telling us that it is young. Same goes for other alleged discrepancies between the testimony of science and the testimony of scripture.