This may help:
“Indian religions often see space and time as cyclical, such that world-systems come into being, survive for a time, are destroyed and then are remade. In Buddhism this happens naturally without the intervention of gods.
One tale told by the Buddha in the Aggan̄n̄a Sutta describes the process of recreation on this grand scale. An old world-system has just been destroyed, and its inhabitants are reborn in a new system. To begin with they are spirits, floating happily above the earth, luminescent and without form, name or sex.
The world in these early stages is without light or land, only water. Eventually earth appears and the spirits come to taste and enjoy it. Their greed causes their ethereal bodies to become solid and coarse and differentiate into male and female, good-looking and ugly. As they lose their luminescence the sun and moon come into being.”
From BBC