The Uchiha Clan Massacre is an event that took place five years before the start of the series:
Following the Demon Fox Attack of Konoha, Konoha's leadership began to suspect that an Uchiha was behind the attack. In order to keep an eye on the Uchiha they were forced to live in a small corner of Konoha, creating dissent within the clan. When members of the clan began planning a coup d'état, Itachi Uchiha was tasked with spying on Konoha. Instead, Itachi became a double agent and provided Konoha with information of the Uchiha. Hiruzen Sarutobi tried to open negotiations with the Uchiha, but time ran out and Hiruzen's advisers ordered Itachi to wipe out his clan.
Prior to the massacre, Itachi confronted Madara Uchiha, who had infiltrated the village. Madara having decades earlier been shunned by the clan,still held some resent. Itachi offered Madara the chance to help him wipe out the clan, in exchange for promising not to attack Konoha, a deal which Madara accepted.
In one night, Itachi, with Madara's help, killed every member of the Uchiha clan, apparently killing his own parents last. Itachi's younger brother, Sasuke Uchiha, returned that night to find Uchiha corpses littering the streets. When he found Itachi standing over their parents' bodies, he realized what had happened and tried to run. Itachi stopped him and told him he was not worth killing, instead encouraging him to get strong enough to take revenge.
In reality, Itachi was defying orders by not killing Sasuke, his brother's life meaning more to him than anything. He hoped that by sparing Sasuke and making him live a life of vengeance, Sasuke would someday kill him to avenge their family. He threatened Konoha's leadership, Danzo in particular, to keep Sasuke safe or risk him going public with everything he knew. Itachi left the village and joined Akatsuki to keep Konoha safe from the organization until the day that Sasuke would come looking for him.
Sasuke, unaware of the truth behind the attack, would strive for power from that point further. This leads to him seeking out Orochimaru at the end of Part I. Under Orochimaru's guidance Sasuke is able to gain the strength he needs, and during Part II he is able to bring about Itachi's death. Madara confronts him immediately afterwards and informs him of Itachi's real reasons for wiping out the Uchiha. Crushed by this revelation, Sasuke resolves to destroy Konoha to avenge the tragic lives both he and Itachi led.