In the table-top wargame Warhammer 40,000, the Chaos Space Marines or Chaos Marines, are Space Marines who serve the Chaos Gods. They are also referred to as the Traitor Legions, primarily in background material written from the perspective of the Imperium.
The background shown in both Codex: Space Marines (Haines and McNeill, 2004) and Codex: Chaos Space Marines (Chambers et al., 2002) states that the Chaos Marine Legions were nine of the twenty Legions of Space Marines who fought in the Great Crusade for the Imperium of Man. At this time the Warmaster Horus, first among the Primarchs, and the Luna Wolves Legion (later the "Sons of Horus") were corrupted by Chaos and instigated the galaxy-wide civil war known as the Horus Heresy.
Further background to the Chaos Space Marines is explored in detail in the 'Horus Heresy' series of novels. After the death of Horus and the end of the Heresy, the remnants of the nine Legions along with the other Imperial forces that had joined Horus escaped to a warp-infested area of the galaxy connected directly to the Immaterium that is known as the Eye of Terror. Due to the nature of Chaos, and the temporal instability of the Warp, the very same Chaos Marines who revolted against the Emperor continue to fight against the Imperium.
The Legions have kept their old names, with the exception of the Sons of Horus who were renamed the Black Legion by their new leader, Abaddon the Despoiler. Besides Horus, two other Chaos Primarchs were believed to have been killed during or shortly after the Heresy (Konrad Curze of the Night Lords and Alpharius of the Alpha Legion.) The seven surviving Primarchs have since become Daemon Princes. These daemonic Primarchs rarely take part in the affairs of their Legions or any part of the Warhammer 40,000 universe. For example, Magnus the Red, Primarch of the Thousand Sons is the most powerful of all the Daemon Prince sorcerers. Yet he rarely enters the battlefield, even though prior to the Horus Heresy he always took part in his Legion's battles and was a determined warrior. Angron however, Primarch of the World Eaters, led an invasion force in what was to become the First War of Armageddon. Some of the Legions have pledged a particular loyalty to one of the four Great Chaos powers but the eight Blood Lords are loyal to Angron alone. The same is the case with the Death Guard, where the Primarch Mortarion's war council is known as the Lords of Decay. Abaddon the Despoiler has taken charge of the Sons of Horus, now known as the Black Legion. Abaddon is the only Chaos Marine since Horus to be able to command the loyalty of all nine Traitor Legions (albeit, temporarily after intense bargaining), and has led thirteen Black Crusades against the Imperium of Man.