I read that cardinal Ratzinger stated the story in Genesis 1 and 2 should not be interpreted as a literal account of the beginning of things. In spite of recent events like this, they have always been in favour of a literal explanation of creation based on Genesis. This is what I read. Why is it that the Catholic church changed their views on such an important matter?
Ratzinger writes at such length as to obscure the point, in my opinion. If you read the Catechism of the Catholic Church, 283 (2nd ed.), the reasoning is spelled out in a brief and clear form:
That is, they recognize and appreciate the value of scientific studies for the information they yield about matters including the history of the universe and life on earth. This is entirely consistent with their stance that faith and reason can never truly be in conflict (CCC 159):
In this case, the scientific evidence against a literal reading of Genesis is so overwhelming that if truth cannot contradict truth, it suggests that the error is to read Genesis literally. I do not know why it took so long for the Catholic Church to recognize this, but the current position is internally consistent and reasonable.
If they were to continue to insist on a highly literal interpretation, they would have had to drop their position on discrepancies and simply state that faith wins. That would have been a much larger doctrinal change than maintaining (as they do, to my understanding) that Genesis 1 and 2 is spiritually accurate without being a literal account of all events.
More on this topic can be found in a large number of places, including here.
My mother-in-law has that book you link to (she's a very traditional minded Catholic and would be aghast if the Pope invalidated the Genesis account). I read a little of it and it's more or less a collection of meditations written by then Cardinal Joseph Ratzinger, it has no official doctrinal significance and is little more than his opinion. Frankly, I'm aghast that someone could infer from a collection of meditations, written by a man who didn't even really want to be pope, something about Catholic doctrine.
There's a lot more to those answers than just yes's or no's, but it's nice that initially they don't mince the words. I'll leave it to you to get your hands on a YouCat in case you want to know more, just find someone who went to World Youth Day in Madrid in 2011 and they ought to have one in your language.
However, and to your exact point, question #46 has a more nuanced answer. I won't quote it completely since it's copyrighted, but I'll try to give you the gist of it all.
It goes on to give 7 points, which I'll phrase in my own words.
The 7 days account are symbolic of these principles:
Science is not going to inform our theology any more than theology is going to inform science. They're completely separate entities and they tell us completely different thing. Theology is infinitely more important than science since it concerns our ultimate destiny and knowledge of science is not necessary for entrance into Heaven. Science is not the realization of what is hoped for nor the evidence of things not seen. Theology is for the simple (Virgin Mary, St. Bernadette, St. Juan Diego, the 3 Children from Fatima) and it was not incumbent on them to understand complex theological principles any more than it was incumbent on them to understand complex scientific principles to receive God's grace.
If you show me one scientist who fully understands the Big Bang, Evolution and Quantum Mechanics, I'll show you one scientist who fully appreciates God's grandeur in the infinite and infinitesimal.
Finally, I'll leave you with the words of Pope Benedict XVI (in the margin of the YouCat)
2. Mass for the Inauguration of the Pontificate, thanks St. @ath
This is because he professes that the Bible was constructed from pagan sources and therefore he doesn't think its true or take it literally,
If the biblical creation account in the book of Genesis is based in part on pagan creation accounts, then it is neither original nor inspired directly by God. It's heresy and another reason he is not a Catholic, and was not a Pope. He was the head of the counterfeit Catholic Church set up in the last days prophesied by Our Lady of LaSalette, Pope St Leo XIII, Our Lady of Fatima and The Book of Revelation.
More recently, Pope Francis has made a statement that more than confirms Cardinal Ratzinger's position. Francis said it was easy to misinterpret the creation story as recounted in the book of Genesis, according to which God created heaven and Earth in six days and rested on the seventh, saying, “When we read the creation story in Genesis we run the risk of imagining that God was a magician, with a magic wand which is able to do everything.” Pope Francis said there is no incompatibility between the Big Bang or evolution, and God as divine creator.
Notice that this position, like that of Cardinal Ratzinger, is incompatible with traditional readings of the creation account in Genesis. Undoubtedly the evolution of the Church's position has come about because anything else would become increasingly unsustainable as science moves forward in understanding the origins of the world. Even in the third century, Origen recognised that traditional readings of the creation account in Genesis are contrary to reason (De Principiis, Book 4.1.16):