As per astrology Rahu is one of the Navagrahas (9 planets) who is paired with Ketu. Rahu is described as a serpant without body who rides a chariot with 8 black horses. Rahu is mentioned in hindu tradition as a rougue planet whose other name is Bhayanaka and considered as a severed head of an Asura named Svarbhanu who swallows the sun which causes eclipses. Rahu kalam in a day is said to be the time which is influenced by Rahu and it is believed as inauspicious as per hindu tradition.
As per Buddhist mythology it is believed that in the Candima sutta and the Suriya sutta, Rahu attacks Surya(the Sun) and Chandra(the moon), before releasing them the two deities recited their reverence for the Buddha. Hence as Buddha enjoins Rahu and hence his head was splitted into seven pieces. From then on the verses recited by the two deities are treated as protective verses and the same is incorporated in the Buddhist liturgy as prayers for protection.