Good question. The days in Genesis 1 seem to be actual 24 hour days because the text talks about "The evening and the morning" for each creative period.
However, there can be a huge gap between verse 2 and verse 3 when the creative acts which formed the earth began.
Some say the billions of years which scientists talk about can be accounted for between verses 2 and 3 while the actual creation of life on earth was accomplished in 6 literal days.
Another viewpoint is that the 6 days are days of revelation to Moses or to Adam about the fact of creation and that it took 6 days for this process of revelation to be complete. This would be much like the visions given to the apostle John recorded in the book of Revelation about the process of bringing God's New Creation into being.
We can speculate all we want about these things but the fundamental facts are that God created all things. They are the product of His divine mind. Human beings are a special creation of God.