First you should understand one thing is that all stories in Hinduism are mythical and contains hidden meanings. Actually Brahma didn't create this earth, he created the whole world, means all other planets including our earth...
People may confuse with this sloka and assume that there many Brahmas and Shivas....
Śrī Caitanya Caritāmṛta Madhya 21.58
ananta brahmāṇḍera yata brahmā-rudra-gaṇa
cirloka-pāla-śabde tāhāra gaṇana
ananta — unlimited; brahmāṇḍera — of the universes; yata — all; brahmā — Lord Brahmās; rudra-gaṇa — and Lord Śivas; cira-loka-pāla — permanent governors of the worlds; śabde — by the word; tāhāra — of them; gaṇana — counting.
"Actually it is very difficult to ascertain the number of universes. Every universe has its separate Lord Brahmā and Lord Śiva, who are known as permanent governors. Therefore there is also no counting them.
But we go through the detailed meaning the purpote is,
Lord Brahmā and Lord Śiva are called cira-loka-pāla, permanent governors. This means that they govern the affairs of the universe from the beginning of the creation to the end. In the next creation, the same living entities may not be present, but because Brahmā and Śiva are existing from the beginning to the end, they are called cira-loka-pāla, permanent governors. Loka-pāla means "predominating deities." There are eight predominating deities of the prominent heavenly planets, and they are Indra, Agni, Yama, Varuṇa, Nirṛti, Vāyu, Kuvera and Śiva.