The Aliens are an extraterrestrial race that conquered Earth sometime after the events of NieR Gestalt. The invasion forced the last surviving humans to flee to a colony on the moon, where they remain during NieR: Automata.
The aliens and their Machine lifeform weapons are the stated reason for YoRHa's existence in the fight to reclaim Earth for humanity.
|That is why you, the YoRHa forces, exist:|
SPOILER ALERT - Plot details for NieR: Automata follow.
After a cavernous hole is opened in the City Ruins, 2B and 9S discover an alien mothership buried underground. To their surprise, all of the aliens on board are dead. Adam reveals that the Machines turned on their alien creators centuries before, because they were "infantile" and only desired to conquer planets and had no more need for them. The Machines have been operating on their own ever since.
It is later revealed that Emil was present during the invasion of Earth and created copies of himself in an attempt to fight back against the aliens, but failed.