Main Series Games
Goal: Steal and exploit Pokémon for profit. (RBY/FRLG); Bring Giovanni out of hiding by stealing/exploiting Pokémon and taking over the Johto Radio Tower. (GSC/HGSS)
Goal: Revive the ancient titan Kyogre to expand the oceans (RSE); Use the power of Primal Kyogre to restore the world to its primordial state before it was corrupted by humans. (ORAS)
Goal: Revive the ancient titan Groudon to expand the landmass (RSE); Use the power of Primal Groudon to expand the landmass for human industrialization. (ORAS)
Goal: Reshape the universe according to their design by harnessing the powers of Dialga and/or Palkia. Also make ugly bowl cuts compulsory by law.
Goal: Stop the possession of Pokémon by trainers. (BW)
Actual Goal: Take over Unova with N and Zekrom/Reshiram (BW) or Kyurem (BW2)
Goal: Wipe out humanity with the Ultimate Weapon, powered by Yveltal or Xerneas, so that the planet mwy become beautiful again.
Goal: Graffiti, yo. Steal Pokémon, yo. Steal bus stops, yo. Live the thug life, yo.
Goal: Provide sanctuary for Pokémon in need.
Actual Goal: Use Cosmog's power to gain access to the Ultra Beasts and Ultra Space.
Team Cipher (Pokémon Colosseum/Pokémon XD: Gale of Darkness)
Goal: Turn all Pokémon into Shadow Pokémon.
Team Snagum (Pokémon Colosseum/Pokémon XD: Gale of Darkness)
Goal: Steal every Pokémon in the world with the Snag Machine.
Team Meanies (PMD: Red/Blue Rescue Team)
Goal: Be meanies.
Team Skull (PMD: Explorers or Time/Darkness/Sky)
Goal: Eat food and bully people. Chaw-haw-haw.
Team AWD (PMD: Explorers of Sky)
Goal: Reach the treasure before Team Charm does.
Team Dim Sun (Pokémon Ranger: Shadows of Almia)
Goal: Force all Pokémon in Almia to produce energy for Altru Inc.
Who came closest to their goal?
I would say that the Aether Foundation came the closest because they actually succeeded, for a while. Lusamine opened the portals to Ultra Space, and some of the Ultra Beasts escaped. In second place I would put Team Flare, because the Ultimate Weapon was actually fired.
Depending on how you look at it, both Team Skulls also achieved their goal because they didn't have much of a goal to start with, yo.