Dattatreya had wonderful parents: the sage Atri and his wife Anasuya. Dattatreya was an incarnation of Vishnu according to some Puranas.
Why did Lord Vishnu incarnate as Dattatreya? The Brahmanda Purana traced the story back to a hermit named Ani-Mandavya who meditated under a vow of silence. In pursuit of robbers who dropped their loot beside Ani-Man- davya, the king’s guards bound the yogi and dragged him off to prison. The king ordered his execution on a trident, and Ani-Mandavya suffered but did not die.
Adding another element of the divine plan, Silavati, a devoted wife, was carrying her leprous husband Ugratapas on her shoulders to the house of a harlot, as was his wish. They passed by Ani-Mandavya, who was still alive even though he was skewered on the trident. Mandavya saw them and cursed Ugratapas to die before sunrise. (See “Ani-Mandavya” for the ending of that episode.)
Silavati used her acquired siddhis (ascetic powers) to cause the sun not to rise. And when it did not rise, the gods went to the Trimurtis (Brahma, Vishnu, and Siva) and prayed that the problem be solved. The Trimurtis went to Anasuya and asked for her help with Silavati. Anasuya and the gods succeeded in getting
Silavati to allow the sun to rise by granting that her husband Ugratapas would not die. Then the Trimurtis gave Anasuya a boon. She stated that she did not want any boon, except that the Trimurtis take birth as her sons. The boon was granted. Vishnu was born as Dattatreya, Siva as Durvasa, and Brahma as Candra.
Dattatreya grew up as a hermit with wonderful siddhis. Arjuna under the patronymic (a name formed from that of a father or ancestor) of Kartavirya (also Kartaviryarjuna) came to Dattatreya and worshipped him. This pleased Dattatreya, and he gave King Kartavirya a boon of a thousand arms. The Brahma Purana stated that further worship brought gifts of a golden chariot, power to rule justly, a boon to conquer the earth and to rule it righteously, and invincibility—death only at the hands of a warrior whose fame had spread over the entire world. King Kartavirya (Arjuna) then ruled for 85,000 years of peace and prosperity. The bringing about of such a rule of dharma would be a worthy reason for the incarnation of Vishnu as Dattatreya. However, though the longing for such a rule to supplant that of Muslims in late medieval India may have influenced the myth, the expectation failed. And Dattatreya failed with it. He became a victim of Ravana’s conquests, confined like a wild beast in the corner of his city. Another ending of his life made him a thief, robbing the wife of Jamadagni of the calf of the divine milk cow. He was punished by another avatara of Vishnu, Parasu-Rama (Rama with the ax), with some versions stating that Parasu-Rama came into human form just to kill Dattatreya (one incarnation of Vishnu killing another).