In the 21st century, Earth built their first jump gate and launched it towards Alpha Centauri. However, in a midflight test, the Earth jump gate locked onto a random gate not built by humans. They had discovered the X-Universe gate system.
All the planets discovered were totally absent of intelligent life note . Earth built a fleet of self-replicating and self-evolving Terraformer ships to make the worlds habitable for humanity. About a hundred years later, after the mission was complete, Earth sent out a command for the Terraformers to self-destruct. Not long after, the Terraformers showed up in the Solar System in force and began terraforming everything in sight - including inhabited planets and stations. is is heavily implied that the Self-distruct order was sabotaged by a deranged engineer/programmer involved with the project enraged at loosing his livelihood Nathan R.Gunne, a Terran commander, lured the Terraformers past Earth's jump gate into the X-Universe, then destroyed the jump gate behind him to isolate the Terraformers (now dubbed the Xenon) and to save Earth.
Gunne crash-landed his frigate on Sonra-4, an Earth-like world, and began restarting civilization with his crew. They named themselves the "Argon" after R. Gunne. The Argon erased all mention of Earth from their histories to prevent anyone from leading the terraformers back there. After a couple hundred years, Earth became a fairytale legend. The Argon began exploring the X-Universe, and discovered the peaceful Boron, the Holier Than Thou Paranid, the warlike Split, and the profit-obsessed Teladi, the last of which gathered the others into a loose alliance called the Community of Planets. They also rediscover the Xenon.
In the 30th century AD, a Xenon ship equipped with a prototype jumpdrive blundered into the Solar System and was captured by the isolated Terrans. They reverse-engineered its jumpdrive and built the Xperimental Shuttle to try and reach Alpha Centauri. However, the jumpdrive locked onto the X-Universe and promptly breaks down, stranding the pilot (and protagonist) in the X-Universe and indebted to the Teladi, who helped repair his ship. The Earth pilot, Kyle Brennan, helped prevent the Xenon from blowing up a planet with their M0 Planet Killer in the first game, X: Beyond the Frontier. A couple years later Brennan and his friend Elena Kho, who followed him to the X-Universe to rescue him and was trapped there when her ship was destroyed, set up the company TerraCorp to try and recreate the jumpdrive so they can get home, forming the backdrop to the expansion pack X-Tension. (The expansion doesn't actually have a plot; this is from the manual.)
A few decades later in X2: The Threat, the Khaak showed up. Their first act in the universe was to destroy everything in the sector President's End, and then to nearly destroy the planet in Omicron Lyrae. The Player Character, Kyle Brennan's son Julian, helps to defeat them and destroy their planet-killer.
After the Khaak planet killer is destroyed, a Precursor shows up and begins secretly aiding the Paranid in building a jump gate. The Paranid activate their jump gate in Heretic's End — which links to Earth, right as the Kha'ak are jumping into the sector to try and destroy the Paranid jump gate. The entire Terran AGI Task Force fleet - completely forgotten by the rest of the universe - streams out of the jump gate and curb stomps the Kha'ak. The Terrans establish tentative relations with the other races, but try to remain isolated — hence the game being named X3: Reunion.
X3: Terran Conflict reunites the long lost Aldrin colony with Earth, destroys the Kha'ak Hive Queen, and sees a rise in tensions between the Argon Federation and the Terran State.
In X3: Albion Prelude, the cold war goes hot with the destruction of Earth's orbital defense station/shipyard, the Torus Aeternal. The war lasts about a year, and as more and more of the patrols holding the Xenon at bay are reallocated to the warfront the Xenon begin to get out of control. To prevent the total destruction of the Community of Planets races and Earth, the Ancients shut down the entire gate network at the end of 2948.note
X Rebirth will take place much later, and deals with efforts to get the jumpgate network working again.