It's status within the series canon (aside from it's Sonic X incarnation) is that of a worldwide military/emergency law enforcement organtization, and it's duty is to protect the world.
The origin of the name probably stems from the Japanese word for 'army' which is simply 'gun' or guntai. It is similarly likely the full title of the organization - G.U.N, or Guardian Units of Nations - is a backronym. Though the name is pronounced "gun" in most games they are in, it was pronounced "G-U-N" in Sonic the Hedgehog.
Sonic Adventure 2Edit
In Sonic Adventure 2, the GUN organization was introduced. As the plot is revealed, it is shown that GUN were responsible for the mistaken capture of Sonic the Hedgehog, the ending of Project Shadow, the invasion and subsequent deactivation of the Space Colony ARK and the death of its inhabitants - including Maria Robotnik. GUN's role in this game is simply to contain the threat posed by Shadow the Hedgehog and Dr. Eggman. However, they also attack Sonic and his friends (although many factors, such as GUN's mistaking of Sonic for Shadow, and Tails' attack on Prison Island, might have provoked this), and in Rouge's first level, GUN is seen holding a turtle at gunpoint. It is unknown why they were doing this, and the reason was never explained. The organization was never specifically called "GUN" by the characters, who instead referred to them as "the government" or "the millitary". The word "GUN" is instead just seen on GUN's technology and boxes that are spread around the game.
Shadow the HedgehogEdit
The role of GUN in Shadow the Hedgehog's' plot is to repel the invasion of Earth by the forces of the Black Arms by any means necessary - including the (presumingly unwanted) assistance from Sonic and his friends. During the opening FMV sequence, it is shown that Earth is being overrun, with GUN's forces almost helpless - hence the temporary alliance. It is also strongly hinted during the game and FMV sequences that GUN's mission is the investigation (and possible destruction) of Shadow himself, depending on the player's moral choices within the game. Their attempts at doing this are caused by the commander of GUN due to his personal hatred of Shadow, although in two endings he realizes Shadow isn't evil.
GUN's role in Sonic Adventure 2 was also expanded in Shadow the Hedgehog, where one of the levels takes Shadow and Maria through the colony during the GUN incursion and it also shows Shadow fighting one of their weapons after they try to harm Maria.
In the Huge Crisis Zone of Sonic Rush, the enemies look similar to GUN Hunter and Hawk robots, and they do not release animals when defeated. It is unknown why they attacked Sonic and Blaze.
Sonic the Hedgehog (2006)Edit
GUN has a small role in the 2006 Sonic the Hedgehog game. Shadow has now become an agent of GUN, whom they requisition to find Rouge the Bat as she has been kidnapped by Eggman. After Rouge is saved, GUN appears even less, and is just occasionally contacted by Shadow and Rouge for various reasons.
Among the 150 collectable cards in Sonic Rivals, 7 are GUN-related pictures. These cards are "The Commander", "Big Foot", "Flying Dog", "Hot Shot", "Gun Wing", "Hornet-6" and "Shield Hunter".
GUN is mentoned in the opening cutscene on the radio saying that they are investigating the out of control robot problem.
Sonic Chronicles: The Dark BrotherhoodEdit
They appear to help Sonic & Friends find Knuckles. They are first seen helping in destroying the Egg Carrier. They appear later fighting of the Marauders and have a headquarters in Central City as well as taking patrol in Mystic Ruins. They are investigating Knuckles disappearance and hired Team Chaotix to learn more about the Marauders. Just before Sonic and friends traveled to the Twilight Cage they gave Rouge instructions to gather any Maraunder technology for the scientists to research and possibly re-engineer.
In Sonic X anime and Sonic X comic, GUN is a military branch of the United Federation. They took Eggman's technology and, with a few tweaks, created their own robots. They also took Eggman's Eggfort and turned it into their attack vehicle. Rouge appears with her partner, Topaz, a character exclusive to the show.
Sonic the Hedgehog (Archie)Edit
The Archie-published Sonic the Hedgehog comic book features GUN as an elite military unit of humans. Sonic and the Freedom Fighters first encountered them when both teams went to Pyro Island, the lair of Zan the Dragon. Working together, they were able to seemingly kill the dragon.