It is not known exactly when Holi originated but there is mention of the celebration as early as the 4th century in ancient Sanskrit texts and poems. It has always been known as a festival of colour with the word 'Holi' deriving from the name of the Hindu demoness 'Holika'.
Legend has it that Holika was the sister of the arrogant demon king Hiranyakashyap, who demanded that everyone in his kingdom worship him. His son, Prahlada, remained loyal to Lord Vishnu, which enraged his father. In an attempt to kill his son for his treachery, Hiranyakashyap had Holika trick Prahlada into entering a burning pyre, knowing that his sister would be unharmed for she was immune to fire. Prahlada entered the fire chanting Lord Vishnu's name and he was blessed with his life, whereas Holika unknowingly sacrificed her own as she was only immune when entering fire alone.
It is thought that Lord Vishnu then appeared and killed Hiranyakashyap in an act of good over evil. The next day people gathered around the debris of the fire and smeared their faces with ash. Over time this morphed into the use of coloured powder.
Krishna is also associated with Holi due to his blue skin, which was a result of the she-demon Putana poisoning him with her breast milk. Young Krishna was worried that girls would not like the colour of his skin and so his mother encouraged him to playfully colour the face of Radha so that they would be equal. Their relationship is honoured in the act of applying coloured powder to friends, family and even strangers.