It isn’t explained. They were there when Adam and Eve were expelled. Which means they were kinda like an experiment for God.
But God is all-knowing, he basically set a trap on them knowing the outcome. He knew he was going to punish humanity even before he created the universe.
“Jusr wait until I create these mofos, the ass whooping I’m gonna give them… Fucking hell, I love working in mysterious ways”