The story of Dattatreya is told in many Purana-s, and this is from the Markandeya purana (chapter 15). A brahmin named kaushika was enchanted by a courtesan and lost his wealth, health etc. However, his wife, Shandili was faithful to him. She even carried him on her shoulders to the courtesan's place. Once, by mistake, she stepped on Sage Mandavya and the sage cursed both of them to die by sunrise. Shandili prayed and appealed that the sun may never rise so that her husband would live. Her prayer was answered and the devas were in an uproar seeing the world order of time destroyed. They asked for the help of Anusuya, the wife of sage atri, to convince shandili. Anusuya was able to convince shandili on the condition that kaushika would live on sunrise. In appreciation of Anusuya's intervention, the gods granted her three boons. She asked for her liberation, her husband's liberation and that the three gods Brahma, Vishnu and Shiva be born as sons to her. The wishes being granted, from Sage Atri's eyes issued a light and served as the seed for the divine sons - Soma, Durvasa, and Datta - partial incarnations of Brahma, Shiva and Vishnu, respectively.
Other purana-s give different narratives but all involve the attribution of the name Dattatreya to mean 'Son of sage Atri.' For example, there is a story is that the gods decided to test the chastity of anasuya, the wife of the rishi Atri. So, brahma, vishNu and Siva went to her posing as handsome men. However, Atri was not fooled and transformed all three of them into a single child with three heads. This child is known as Dattatreya and is considered to be an incarnation of the trinity Gods.
He is said to have lived a rather unconventional life, first being a warrior, then renouncing the world and practicising yoga and then drinking wine and living with a maiden etc to show his disciples that he could be unattached to such mundane pleasures even if he indulges in them. Dattatreya is said to have met Shankara near Kedarnath before Shankara's mahasamadhi. There is a still a cave in Kedarnath signifying this event.
Regarding the works by him, probably the most controversial is that it is mentioned in the Markandeya purana that he taught the asthanga yoga to Patanjali, who then wrote the yoga suutras. He is also attributed to the composition of the jivanmukta -gita which is a short compendium of 23 verses which talks about the jnani (jivan mukta). Dattatreya is also attributed with avadhuta gita, a text of eight chapters. Swami Vivekananda once said of this book, 'Men like the one who wrote this song keep religion alive. They have actually self-realized; they care for nothing, feel nothing done to the body, care not for heat, cold, danger, or anything. They sit still enjoying the bliss of Brahman.' Dattatreya is the narrator of the Jnana Kanda of tripura rahasya to Parasurama to dispel the latter's doubts on liberation. (The story of Samvrata found in tripura rahasya has been cited by shankara in his brahma suutra bhashya). Further, Dattatreya is attributed with a couple of Tantric works.
Dattatreya is also mentioned in the Mahabharata. I also believe that certain vaishnavites hold him in high esteem since he is mentioned as a incarnation of vishnu.
Dattatreya is usually depicted with four dogs by his side, representing the four vedas, a cow behind him (a la vishNu), a trident in his hand (a la Siva) and three heads (a la brahma). He is widely worshipped as a diety throughout India and you can find stotra-s (hymns) dedicated to him.
The lineage of the Nav Nath sampradaya which traces its origin to dattatreya is extant. The modern jnani Nisargadatta Maharaj is well known. Though he lived in the slums of Bombay, India, he spread the fragrance of advaita vedanta to one and all. His disciple, Ramesh Balsekar, educated in the west, continues the tradition.