The story of X-Com goes thus:

The First Alien War
In the late 1990s, sightings of UFOs increased tenfold. Tales of alien abduction and experimentation struck terror into the hearts of the world's population. The sightings were far too frequent to be the mere coincidences they were once dismissed as. To defend the Earth, countries began forming their own alien defense forces. The most notable, the Japanese fighter squadron Kiryu-Kai, highlighted just how technologically deficient the Earth was in the face of the aliens, and after 5 months not even one UFO had been successfully intercepted.

On December 11th 1998, the world's most powerful nations held a secret summit in Geneva. The solution they reached was a jointly-funded independent force designed specifically to fight the alien forces. Equipped with the finest technology, soldiers, pilots and scientists on the planet, the organisation would have the entire world as its jurisdiction. The new force was dubbed the Extraterrestrial Combat Unit, or X-Com.

With only inferior equipment, over the next five years X-Com successfully shot down countless UFOs, captured aliens and recovered alien technology. Reverse-engineering the captured technology, X-Com developed weapons far in advance of anything the armies of Earth possessed. In spite of their best efforts shooting down UFOs, protecting cities from terror attacks and destroying bases the aliens attempted to build; it soon became clear that if the war remained on Earth it could only serve to delay the inevitable.

Interrogation of captured alien ship captains and base commanders eventually revealed the aliens had a main base on the surface of Mars called Cydonia, near the famous face-shaped rock formation. Sending one of their best ships filled with their best soldiers, X-Com stormed the Cydonia base and confronted the alien brain. The brain revealed the Earth was in fact seeded by the aliens millenia ago, and that humanity is just one of the scores of races throughout the galaxy. The squad destroyed the brain, thus ending the First Alien War.

2005-2039
In the aftermath of the First Alien War, the governments of the world soon forgot their shaky alliance and began their squabbling. X-Com was dissolved, relegated to skeleton staff. The peace was not to last. Reports began to come in of strange creatures terrorizing coastal areas and shipyards.

Terror from the Deep
X-Com was hastily reassembled as a maritime defense force. Responding to the strange sightings, a strange similarity between the sea creatures and the aliens from the First Alien War was noted. However, these aliens travelled in remarkably fast flying submarines.

Most of X-Com's technology from the First Alien War was useless underwater, thus they were forced again to gradually capture and research alien technology in order to stand a fighting chance.

Information gleaned from the aliens revealed the truth: 65 million years ago, a massive alien colonization ship called T'leth had crashed while attempting to land on primitive Earth. The resulting dust cloud is thought to have triggered the deaths of the dinosaurs. A primitive race of amphibious humanoids, a distant offshoot of humankind, was forced into joining the aliens or die in the aftermath of the impact. And so, for millenia, T'leth has rested at the bottom of the Gulf of Mexico.

When the Ethereals commanding the First Alien War's invasion forced arrived, they detected the T'leth's distress beacon. The last transmission from Cydonia before it was destroyed by X-Com was back to the alien homeworld announcing this discovery. Realizing the significance of the find, the alien leaders beamed a reactivation code to the T'leth.

Using this information and newly-developed submarines capable of reaching the ocean deep where T'leth lay, X-Com successfully defeated the aquatic menace.

The Space Colonies
As all of X-Com's technology was alien-based, it required Elerium 115 as fuel. Elerium is not found on Earth, and supplies captured from the aliens during the First Alien War were running low in the 2050s. Pooling their supplies, Earth sent mining ships out of the solar system to search for fresh supplies. Asteroids laden with Elerium were found, and a new gold rush in space began.

However, the alien forces weren't defeated yet, and X-Com was again called into action to defend the mining stations and other human installations from alien incursions, to ensure the supply of Elerium was not interrupted.

Mega-Primus
Back on Earth, things weren't as rosy. More than two centuries of industrial pollution had finally taken their toll on the Earth's ecosystem. The population of Earth was moved off-world, apart from one city - Mega Primus. Specially constructed on the ruins of Toronto (hometown proud!), Mega Primus was completely enclosed from the toxic landscape that surrounded it. It had its own government, its own social structure, and was mostly self sufficient. The world was a very unique place now. Hybrids, the descendants of humans impregnated by the Sectoids during the First Alien War, were now a part of society, as were artificially intelligent robots.

In 2080, strange dimensional portals began appearing in the sky over Mega Primus. X-Com was now one of many competitors in the security and defense marketplace, but was still specially commissioned by the city council to be the official defensive force for the city.

Over the following months and years, X-Com successfully defended the city, not only from the aliens but also from a cult of alien sympathizers, the Cult of Sirius. Utilizing the skills of the Hybrids and Robots as well as humans, X-Com developed their own technology to pass back through the portals themselves into the alien dimension, and destroy the alien's buildings which were fuelling the war.

I have to admit I have not yet finished X-Com: Apocalypse, so I can't tell you exactly what happens at the end. I also haven't played the two newer games, X-Com: Enforcer or X-Com: Alliance. The worst part is the way the complete story of X-Com is spread across countless instruction books, UFOpedia entries and other snippets, so building the complete picture is a nightmare

UPDATE 04/08/2006: The lovely and talented Kizor has volunteered the following conclusion to the X-Com: Apocalypse story, which I feel deserves a home given the effort put into producing it:
"The alien dimension was a dying world dominated by a single, massive biomechanical city. The initial alien infiltration was inexplicable, as they were incapable of surviving in Earth conditions. Eventually it was revealed that the aliens were in the command of micronoids, microscopic hive mind organisms that are the active ingredient in Brainsuckers and can well survive in human hosts. The aliens eventually abandoned infiltration for decimation, constructing massive attack craft and deploying Godzilla-esque creatures. X-COM battered the alien city to the ground, escaping through the collapsing dimension gates and bringing peace to ravaged Mega-Primus. Wheee."
So there we go. Alas, my attempts at actually finishing X-Com: Apocalypse have been repeatedly curtailed by bugs and corrupting savegames (most frustratingly, my recent VDMSound attempt in Expert mode was extremely satisfying, right until the game started crashing on the end-of-day report screen. Bah.