The Avengers were the brainchild of S.H.I.E.L.D. Director Nicholas Fury, who envisioned a team that might work together as a response team in the event that a threat would prove so powerful that no single hero could face it alone. The catalysts for this plan were the appearances of beings with personal levels of power that vastly exceeded conventional military capabilities. He named his plan the "Avenger Initiative".
The Avengers formed gradually through circumstance and reactive planning. Fury initially considered Tony Stark for a role on the team, but discarded this idea due to Stark's unpredictable nature. Eventually the plan was scrapped altogether and Fury refocused his attention on military assets in the hands of S.H.I.E.L.D. instead. However, circumstances proved to be the guiding force that brought the disparate membership of the team together when Loki made a surprise appearance at a S.H.I.E.L.D. research facility, killed a number of soldiers, and escaped with Agent Barton and Professor Selvig under his control, taking the Tesseract with him.
The threat posed by the Tesseract in the hands of Loki forced Fury to reprise his earlier idea and activate a group of people with incredible capabilities. Fury called the time-displaced World War II hero, Captain America back into service, while Stark and Dr. Bruce Banner were brought in for their scientific expertise. When Loki made a public appearance, Stark (with his Iron Man armor) and Captain America rushed to intercept, accompanied by S.H.I.E.L.D. agent, Natasha Romanoff, the "Black Widow". The three of them confronted and captured the Asgardian, although in the effort to bring him into custody they were in turn confronted by Loki's adoptive brother, Thor. This resulted in an altercation when Thor extracted Loki, but once the men had wasted time and effort in a fruitless clash of egos, they resumed the trip together.
Once on board the S.H.I.E.L.D. Helicarrier, the clashes continued, to some extent as a result of Loki's goading. Even though their agendas were largely aligned, their egos and the growing unease surrounding Fury's actions had the group in a frequent state of tension. This persisted until Loki sprang his trap and used a surprise attack from Clinton Barton, still under control, to trigger a new round of falling out within the ranks. The attack left parts of the Helicarrier in ruin, and S.H.I.E.L.D. agent Phil Coulson dead by Loki's hand before Loki himself fled. His killing of Coulson, proved to be his undoing however, because Director Fury used the incident to motivate the remaining people into action. Captain America and Iron Man wanted justice for Coulson; Barton, who had been pulled from Loki's control, simply wanted to put him down; and Romanoff had her own debts to settle. After chasing Loki to New York City they were soon joined by Thor and Banner, both of whom had fallen from the carrier in the attack. Finally, together as a team, the group calling themselves the Avengers assembled to fight off a threat that was larger than any one of them alone.
The hunt for Loki became a battle for New York when Loki opened a dimensional rift above the city to a waiting Chitauri invasion forced stationed on the other side. The Chitauri attacked without hesitation, pouring through in a vast horde of ground troops with air support. The Avengers stood fast against the assault, at first confronting the attacking warriors, and then shifting focus to other prominent target objectives. Not only was there Loki and his alien army to contend with, there were also the Chitauri's leviathans, colossal flying beasts that were as much agents of destruction as they were a mode of transportation. The Avengers were split even further on more fronts dealing with the rift and the technology holding it open, not to mention a nuclear warhead that that had also been deployed to the area at the behest of Earth's governments. They ultimately triumphed when Iron Man redirected the missile through the portal and into the ranks of even more invaders waiting beyond.
In the aftermath of the fight, the Avengers gathered for the departure of Thor, and his now-captive brother, back to Asgard where Loki and the Tesseract would be safely removed from humanity. When the Asgardians had gone, the remainder of the team said their good byes and went their separate ways as well. Fury, musing on their dissolution, observed that some day the Avengers might again reassemble. There may come a time when they would need to.