In the Rig Veda, Vritra was a terrible fiend who gathered all the waters of the world into himself and cause a drought to cover the whole earth. The world became a wasteland. In a distant land, he hid in his fortress, hording his treasure so that the world drew ever more parched. Finally, Indra, who would become the king of the gods, was born. He took it upon himself to attack the demon and release the waters. Drinking immense amounts of Soma to give him the strength necessary, he set off to find his foe. First Indra stormed Vritra's ninety-nine fortresses, razing each in turn, then he met Vritra himself. The two fought a terrible battle, and in the end, Vritra was destroyed by Indra's thunderbolt. Indra then released the waters to flow back to the world.
In later times, the story changed dramatically, giving Vritra a much more sympathetic part. There was a Brahman named Tvashtri, who had a son named Trisiras. Indra was afraid of Trisiras, and ultimately slew him with his thunderbolt. Tvashtri wanted revenge, and created the demon Vritra to achieve it. Vritra challenged Indra, and was able to defeat the god and swallow him. The other gods were afraid at the loss of their king, and they conceived a plan to free him. They forced the demon to gag, and when he did, Indra sprang forth again and the battle continued. But Indra was still no match for his foe, and was compelled to flee. With the intervention of the rishis and Vishnu, a truce was agreed upon, but only if Indra agreed never to attack Vritra again with any weapon made of wood, metal, or stone, with anything dry or wet, or at any time during the day or night. Indra agreed but still wanted to slay Vritra. One day, he was by the sea. The sun was going down, and in the twilight a huge wave washed up on the shore, spraying a great column of foam. It was, at that time, neither day nor night. Indra realized that the foam from the sea was not wood, stone, or metal, nor was wet or dry. He seized the foam and brought it crashing down on the demon, who fell dead, for the foam was actually Vishnu incarnate.
In another version of the story, Vritra was killed by the mother goddess Sarasvati