Maybe God inspired Moses on what to write. After all, the Bible is the inspired word of God. And Genesis is clear that God is the creator of all.
That is a possibility, but how? Was it a vision? did God whisper in his ear? Did Moses having a deep yearning to write about creation, and Genesis is that result? Any and all can be true. We just don't know.
Actually it's a varied assortment of dubious translations from a scattered collection of tattered scrolls handed down from various tribes of sandal wearing bronze age goat herders but, don't let that stop you...