The alien invasion is a common theme in science fiction stories and film, in which extraterrestrials invade Earth either to exterminate and supplant human life, enslave it under a colonial system, harvest humans for food, steal the planet's resources, or destroy the planet altogether.
The invasion scenario has been used as an allegory for a protest against military hegemony and the societal ills of the time. H.G. Wells' novel The War of the Worlds exploits invasion panics that were common when science fiction was first emerging as a genre.
Prospects of invasion tended to vary with the state of current affairs, and current perceptions of threat. Alien invasion was a common metaphor in United States science fiction during the Cold War, illustrating the fears of foreign (e.g. Soviet Union) occupation and nuclear devastation of the American people. Examples of these stories include The Liberation of Earth by William Tenn and The Body Snatchers.
In the invasion trope, fictional aliens contacting Earth tend to either observe (sometimes using experiments) or invade, rather than help the population of Earth acquire the capacity to participate in interplanetary affairs. There have been a few exceptions, such as the alien-initiated first contact that begins the 1951 film The Day the Earth Stood Still, and the Vulcan-initiated first contact that concludes the 1996 film Star Trek: First Contact (although after a failed invasion by the Borg in the rest of the film). In both cases, aliens decide to visit Earth only after noticing that its inhabitants have reached a threshold level of technology: nuclear weapons combined with space travel in the first case, and faster-than-light travel using warp drive technology in the second.
Technically, a human invasion of an alien species is also an alien invasion, as from the viewpoint of the aliens, humans are the aliens. Such stories are much rarer than aliens attacking humans stories. Examples include the 1989 video game Phantasy Star II, the 2007 film Battle for Terra, The Martian Chronicles by Ray Bradbury, the Imperium of Man in the Warhammer 40,000 universe, the 2009 movies Planet 51 and the 2011 movie Mars Needs Moms.
As well as being a sub-genre of science fiction, these kinds of books can be considered a sub-genre of Invasion literature, which also includes fictional depictions of humans invaded by other humans (for example, a fictional invasion of England by a hostile France strongly influenced Wells' depiction of a Martian invasion).