In Genesis, after God created the Earth he said it was good. We know dinosaurs were created but why and when? After living for millions of years why would God have them destroyed if what He created was good? Presumably they were created before Adam and Eve. Did God create the way in which they were destroyed as with the theory of a giant asteroid?
I assume you are aware that there are competing explanations of the Genesis creation story among Christians. There are a number of views, but let me grossly simplify by describing three views:
1. The Day/Age Theory. This view is that the “days” of Genesis represent the successive periods of time over which God created the universe, the earth, various life-forms on the earth and, last of all, human beings.
2. The Scientific Young Earth Theory. This view is that the six “days” of creation in Genesis 1 are literal twenty-four hour periods which occurred several thousand years ago. To this, the scientific young earth theory adds that all scientific evidence can be shown to be in concord with this young earth view.
3. The Theological Young Earth Theory. This view, like the second, takes the “days” of creation to be literal and recent, but explains the creation as an all-powerful God creating the earth and universe with an appearance of age.
Of the three views, the one which cannot be supported from what we know from science is the second view. There is absolutely no way to sustain the belief that scientific evidence can be made to agree with a young earth and universe. Every single line of evidence points to an earth which is about 4.5 billion years old and a universe which is about 13.5 billion years old. Scientific young earth creationists are required, essentially, to ignore all the cosmological and geological evidence for vast age of the universe.
The third view is supportable theologically. Certainly God could, if he wanted, create the universe and the earth, but give them an appearance of age. He could have put millions of layers of sedimentary rock in the ground, put light from distant galaxies on a path toward the earth and create stars which appear to be billions of years old. He also could have created a deep fossil record of species which never existed, but which appears to show some kind of evolution. If this is true, then the answer to your question is that dinosaurs never actually existed, but they are merely fossils created by God in order to make the earth appear very old. Very few are willing to accept this view.
The first view makes sense, both from scientific and theological grounds. If this view is correct, then dinosaurs lived over a time span from about 240 million to about 65 million years ago. You can probably guess that I prefer view #1.
This brings me to your question. Let me broaden the question a bit. Why did God create such a massive universe and why did God use many billions of years over which to create the universe, life, and last of all, human beings? Of course, God does not answer this question for us, but we can speculate. We should remember that for God time and space are nothing. For God to create a universe which is one light-year across or 20 billion light years across is really pretty much the same. The same applies to time. For God to create a massive universe in an instant or to let his creation evolve over great periods of time is really pretty much the same thing. Why did God create life and let it evolve? Perhaps because it is to his glory to do this. Why did he allow amphibians and fish to evolve first, then dinosaurs, and later mammals and birds? Because it is to his glory to do so. Dinosaurs were not bad. Neither were trilobytes and other ancient creatures which no longer exist. From my perspective, evolution was conceived of by God as a means to create the various life forms. Exactly why God chose this means, I do not know. What I know is that the fact that certain species existed for a time but no longer exist is not evidence that God’s creation is not good. Dinosaurs were good, but so are mastodons and giant sloths. All of God’s creation is good and the evolution of that life is not evidence that earlier forms are any less good than later forms.
You refer to the Chixlub asteroid. It has not been proven, but there is fairly convincing evidence that the Chixlub asteroid, which struck the earth about 65 million years ago did massive damage globally to the environment and probably hastened the disappearance of the dinosaurs, and therefore opened the earth to its domination by mammals. Of course, this development led to the evolution of higher mammals, including primates (whether humans evolved or were created ex-nihilo is an open question). The last of all to appear on the scene is modern homo sapiens. It is mankind who God gave a spirit, a soul, consciousness. It is mankind who God created in his image. Did God cause the Chixlub asteroid to hit the earth in order to kick-start this phase of evolution? We cannot know. God’s ways are not completely knowable. In any case, the death of animals is part of God’s plans. Apparently the extinction of certain species is also part of God’s plan. Personally, I believe that evolution was not a fully random process. I believe that God directed the course of evolution toward creation of us. Whether he pre-conceived this process and simply let it happen or intervened to make it happen is hard to prove, but I believe that God did not leave things to chance, but had a definite “plan.”
Dinosaurs are good, but the “goal” of God’s creation was to make us so that we could know Him and be known by Him. It appears that the existence of dinosaurs was a “step” in God’s plan for creating us. This seems to be the biblical view.