The story of the origin of Rudra is found in the Aitareya Brahmana. The legend narrates the emergence of Rudra. Aitareya Brahman is part of the Rig Veda and was authored by Rishi Aitareya.
One day Prajapati out of intense passion chased his own daughter. The daughter took the form of a doe (female deer) and tried to escape. Prajapati followed her in the form of a deer and made love to her.
Devas and other celestial beings did not like this act of Prajapati. But out of fear they did not question or punish Prajapati.
But the anger in the celestial beings separated from them and took the form of various body parts. They then amalgamated it to create a single ferocious being which came to be known as Rudra.
The celestial beings asked Rudra to kill Prajapati.
Rudra put a condition to perform the act that he should be made the chief of the animal world.
The celestial beings agreed and then Rudra shot an arrow hitting Prajapati.
Prajapati is the first born and the progenitor of all beings – sometimes he is identified with Brahma. At other times, Prajapatis were created by Brahma to carry forward the creation.