In Gurren Lagann, when they are about to start the fight with the Anti-Spirals, they mention that the Spirals have tried to attack them before but lost. Then, in the episode when the fight is about to begin, you can see many destroyed battleships. Does this mean that the Earth was destroyed and rebuilt before? Or was humanity not completely wiped out?
It's important to note that Anti-Spirals were originally Spiral lifeforms. However:
The Anti-Spirals realized the truth about the event called "Spiral Nemesis", an event in which the entire universe would be destroyed by an excess of Spiral power. Because of this, they purged themselves of Spiral power and became a collective consciousness (the black creature known as the Anti-Spiral).
The Anti-Spirals then made it their mission to ensure that no Spirals could contribute to this cataclysmic event; this included attacking Earth, where the Spiral lifeforms continued to live. However, they were unsuccessful:
The Anti-Spirals found heavy resistance on Earth, since this was the home of the native Spiral warriors. The Spiral warriors held off the Anti-Spirals, driving them back into space, before pushing further into Anti-Spiral territory.
Lordgenome, a powerful warrior, was the one who led the resistance against the Anti-Spirals and ultimately protected the Earth from destruction. However:
Utterly immersed in the despair the Anti-Spiral had instilled within him, Lordgenome activated his most powerful weapon, the Cathedral Lazengann, and pushed humanity back to Planet Earth, determined to preserve the remaining spiral population by conceding to any demands the Anti-Spiral had. He constructed an imposing castle fortress called Teppelin, and created the Beastmen as enforcers to slaughter human beings living on the planet surface, driving them underground in hope their fear would keep them there along with burying the Lagann in the depths of the Earth's crust.
-- Lordgenome at the Gurren Lagann Wiki
So, no, the Earth itself was never destroyed. The Anti-Spirals tried to obliterate the Spiral lifeforms, but they were not destroyed; they were only suppressed by Lordgenome in an effort to further the Anti-Spirals' protection of the universe.
Humans are not the only spiral life forms in the universe, there are many others that tried to face the anti spirals before humans and before that the anti spirals were spirals that chose to protect the universe from the spiral nemesis, so before them there were other spirals since spirals are any beings with a double helix dna or something like that so dont think spiral = human, cuz spiral is everything that evolves, from life to galaxies and so on u.u