Its called the "gap theory", and surprisingly it does have Biblical credibility. I encourage you to give it a chance even though it seems strange on the surface. Take a look at Isa 45:18, where it says "He is the God who formed the earth and made it, He established it and did not create it formless and void". So It begs the question: How was is formless and void then in Genesis 1:2? If you carefully study the grammar of Genesis 1:2, It literally translates as "But the earth became formless and void".
In the Hebrew there, "But" is an adversative conjunction, denoting an opposite....and "became" is a transitive verb, denoting actionable change.
Once you notice this, another questions is begged: How?....The answer lies in the fall of Satan, perhaps the "profaning of his sanctuaries" (Ezk 28).
The gap theory would also suggest that the Earth we live on was the 2nd earth, or the re-creation of the 1st one.
Again, the intriguing verse is Isaiah 45:18: "He is the God who formed the earth and made it, He established it and did not create it formless and void" (same Hebrew word (Tohu va Bohu)=formless and void/chaos/wasteland/uninhabitable, etc.