The invasion of Konohagakure was former Konoha ninja Orochimarus attemt to get revenge on his former village and teacher, the third Hokage, because he diden't became Fourth Hokage. While his own Otogakure was to small to take on Konoha, he found an ally in Sunagakure, who wanted to destroy Konoha due the fact that the Wind Daimyo had cut Suna's budget and started to send missions to Konoha instead of Suna.
While everybody was busy with the cunin exam, Suna and Oto ninjas was sneaking into the land of fire and surrounding Konoha. To destroy the village, they had a three stage plan.
Oto ninja Kabuto Yakushi sneaks into the audience of the third stage of the chunin exam and puts eveybody to sleep with Temple of Nirvana Technique, in order to remove possible defenders and giving the signal to start.
Orochimaru takes the third Hokage as hostage and traps both of them into a barrier created by the Sound four before forcing third to fight his former teachers, first and second hokage, who was brought back with Summoning: Impure World Resurrection. In the meantime, gigant snakes are summoned to destroy Konohas walls and let Suna and Oto ninjas in. While the ninjas kills the habitants, the snakes destroy the buildings.
The invasion failed because of several reasons.
Kabuto diden't managed to put everybody to sleep and left several strong ninjas awake.
Gaara had been wounded by Sasuke Uchiha and couden't transform. Temari and Kankuro tryed to remove him from the battlefield and heal him. Sasuke follow them and got backup from Naruto Uzumaki, Sakura Haruno, Shikamaru Nara and Shino Aburame. Eventually Naruto and Gamabunta mangaed to defet Shukaku, while third sealed Orochimaru's arms, thus preventing him from using any techniques, while third died in the progress. Seeing the upcoming defet, Orochimaru and his followers fled the battlefield, thus ending the invasion.