the horus heresy was when horus, the primarch of the luna wolves, turned traitor and took 8 other legions with him.
The stories in The Horus Heresy routinely cover the conflict's background, with some going back centuries before the war (and the 31st millennium) begins. In narrower scope, the entire conflict (including the Heresy proper and its proximate formative period), is depicted as having lasted for seven years.
However, the Horus Heresy truly began after Warmaster Horus was wounded by the possessed Eugen Temba wielding the stolen Anathame on the moon of Davin, a place that was cursed by the foul Chaos God Nurgle.
It was called the Horus Heresy because, despite the in-fighting that happened, Horus was the 'face' of the rebellion. He was the Emperor's warmaster and the magnitude of his betrayal from such a lofty position was astoundingly bad for the Imperium and a huge shock.
The approximate sizes of a few of the Legions at the start of the Heresy have been given in various sources: Ultramarines – 250,000. Sons of Horus – Between 130,000 and 170,000. Iron Warriors – 150,000 to 180,000.
The conflict was fought across the Milky Way Galaxy early in the first century of the 31st Millennium and resulted in more than 2.3 trillion dead, 4.6 trillion if one includes the planetary populations purged by the Imperium after the Heresy due to the taint of Chaos corruption.
According to the official lore of Warhammer 40,000, Horus was corrupted by Chaos when he was gravely wounded in battle and left for dead. He was rescued by the Chaos Space Marines of the Word Bearers legion, who worshipped the Chaos gods and sought to corrupt Horus and turn him against the Emperor.
He saw a vision of the future in which the Emperor was worshipped as a god, believed that the Emperor was lying about wanting the Imperial Truth and that being worshipped was the Emperor's master plan, so he began trying to change the future.