The story
Possibly from the red flag used in some historic armies to signal the imminence of battle, or from the red cloth used to enrage bulls in Spanish bullfighting, or more generally from the idea of red as a colour of warning and danger. Compare corresponding idioms in several European languages: Danish se rødt, German rotsehen, French voir rouge, etc.
Etymology from Wiktionary, CC BY-SA 4.0.