Sora, Donald, and Goofy are stuck roaming an area unknown to them, and they eventually make it to Castle Oblivion, where they are introduced to Organization XIII (that's thirteen).
**This is the major plot point that is driving the series. Xehanort's plan is to replicate himself into the thirteen darknesses so he can wage war against the seven guardians of light. This is why the Organization exists, but its members don't entirely know it yet**
Castle Oblivion has a weird side effect where it causes people to forget memories while new ones are created. As SDG (Sora, Donald, and Goofy) make their way through the levels of the castle, a witch named Namine (put an accent on the e and pronounce it nah-mee-nay) replaces Sora's memories with false ones per the instructions of the organization--Namine is spawned as Kairi's nobody.
The main plot of COM is that certain members of the organization--Marluxia (mar-loo-sha) and Larxene (larck-seen)--are attempting to stage a coup and overthrow the organization. In short, this fails due to the efforts of Axel, Riku, and SDG.
At the end of the game, we learn two important things: to properly restore the memories in SDG, they need to be put into a sleep-like state similar to what Ven is in, so that happens for a year as Namine restores the original memories. We also learn that Riku learns to control his power over darkness and chooses to walk "The Road to Dawn"--which basically means he isn't joining himself with the light or the darkness, which makes him a unique keyblade wielder.
**We also meet a man named Diz, who is just the original Ansem working his plot to get revenge on Xehanort**
*Riku was meant to be the original keyblade wielder, according to sources within the series. Sora was the number two option, and when Riku originally chose darkness, this ability was passed onto Sora, which is a good thing and is something Xehanort can't exactly predict*
Part Six: 358/2 Days (the stories of the Organization)
**The stuff in 358/2 Days happens before COM, for the most part**
Organization XIII is run by Xehanort's nobody: Xemnas (zem-nus). He leads his group of peons in the process of collecting hearts to restore Kingdom Hearts. He eventually recruits Roxas (rocks-us), who is Sora's nobody and creates a "puppet" named Xion (dji-own...think of how "djibouti" is pronounced), who is created out of Sora's memories. They go around collecting hearts and yadda, yadda, yadda.
**Yep, getting hearts is another way to get at Kingdom Hearts. Organization XIII realizes it needs to restore Sora to get these hearts more easily, so they help speed up the process**
**Note, this next part happens after COM. Order isn't exactly presented the greatest in the series. A chart is below. Add KH 3D to the end, and it is correct**
Eventually we learn that Xion cannot exist if Sora wants to be woken up from his sleep. Despite not wanting to, Roxas destroys her and those memories are returned to Sora. Throughout this game, we see how Axel--the nobody of Lea, who becomes more relevant later--is strongly tied to Roxas, which gives Lea a strong bond to Sora.
Part Seven: The Nobodies (Kingdom Hearts II)
Roxas has been placed inside a data world--by Diz--where he slowly learns of his existence. The final piece of patching together Sora's memories is returning Roxas to back within Sora. Roxas--who has met and befriended Xion and Namine--returns to Sora (if you haven't noticed by now, Sora's heart holds onto just about everyone and is the center of the story).
SDG are revived and then travel to meet Yen Sid--remember, he taught King Mickey and is a retired Keyblade Master. Yen Sid informs the group of the Organization's plans, and they set off helping worlds and fighting Organization XIII while also looking for Riku--who was locked away in the realm of darkness and is hiding behind the disguise of ASOD.
Along the way, Sora learns of the Organization's plan to use him to restore hearts, and eventually makes his way to "The World That Never Was"--the home of the nobodies. He defeats all of the members of the Organization that he encounters leading up to the final scene. Diz reveals himself to be Ansem and attempts to digitize the contents of Kingdom Hearts to block Xemnas' attempt to restore/reveal it. Eventually this backfires and Ansem is flung back into the realm of darkness.
Sora and Riku then travel to fight Xemnas by opening the door and fighting their way through to him. After they team up to defeat him, they are trapped on a shore--ironically, right across the sea from where Aqua and Ansem have just met--and eventually find a way home through the light.
The group returns to the Destiny Islands and all seems happy--until Sora gets a letter from Mickey, which reveals a few key points.
Part Eight: Data Sora
This part won't take long: we learn that Ansem has hidden some important research inside Sora, and the group eventually gets to thank Namine for her efforts to restore Sora's memories. Mickey and the gang create a data version of Sora, who goes through and debugs the data. Really short game, very little plot reveal.
Part Nine: Mark of Mastery and Xehanort's Master Plan (Dream, Drop, Distance)
So if you've played the series and haven't gotten to this game yet, this is arguably where most of the plot movement takes place. So Sora and Riku get instructions from Yen Sid that they are to be tested for the Mark of Mastery. In order to do this, they must seal the "seven sleeping keyholes"--worlds that are in a state like Ven after being disrupted by Xehanort's efforts with darkness. This involves "diving" into a dream world.
Time to backtrack. Remember Xehanort's master plan? Well, the key here is that Sora is the ideal 13th vessel--they've already tried with Riku, but he was too strong and fought off the darkness. Enter time travel!
**Xehanort has used a complex theory of time travel to round up his younger self, ASOD, Xemnas, Braig (his #2), and Isa (a young boy whose past is relatively unknown) to form a part of Organziation XIII**
Remember the cloaked guy at Destiny Islands? Well, he was there as part of Xehanort's time travel scheme. Part of him needed to be there so that he could return on the day the islands were plunged into darkness so that he could interfere with the goal of awakening the seven sleeping worlds. At this point, Riku saves Sora by diving into Sora's dreams (dream within a dream--Inception style).
Eventually we learn that Xehanort is planning to use Sora as the 13th vessel (well, Riku was the ideal vessel, but that effort failed), and Riku is there to save him. In an epic final scene, Lea (restored when his nobody Axel sacrificed himself to save SDG in the realm between) appears and saves Sora from Xehanort's attempt to make him the vessel.
**If you're confused: the original Xehanort has been restored since ASOD and Xemnas were defeated. Those two are back, however, because Xehanort had enough foresight to use time travel to bring them back to the present day so that they can be used as vessels. Yes, Xehanort is one of the smartest dudes ever**
After thwarting Xehanort's master plan for the time being, we learn that Sora has been put into the coma-like state of sleep that Ven is in. Riku, through his journey, has gained the ability to unlock other people's hearts, so he dives into Sora's heart, defeats the darkness, and meets Ansem--who gives him the contents of his research that were hidden inside Sora. Eventually Riku returns to the realm of light and we see everyone in Yen Sid's study. Riku is granted the title of Keyblade Master and Sora is not. Also, we learn that Lea has now gained the power to use the keyblade after--making an assumption here--Yen Sid performed the ritual of passage onto him.
In the secret ending of the game,Riku returns with Kairi, who can wield the keyblade herself.
So here's what exists at the present day heading into Kingdom Hearts III:
1) Xehanort has gathered many of his past selves and can use time travel to get them back at any time. This means he can gather the 13 darknesses for one big fight. We "know" that the ones involved for sure are:
Terranort (this is a bit of a stretch, but seems to be a consensus that he'll be involved)
2) The "guardians" of light have started to take shape:
Aqua (who is still roaming the realm of darkness for all we know)
Ven (who is still asleep inside the Chamber of Sleep at Castle Oblivion)
Lea (this spot may be reserved for Terra, but it's unknown at this point as Terra is still possessed by Xehanort)
3) Sora has been recruited by Mickey to go off on this next journey.