The asura Mahishi was burning up with anger at the trick the gods had pulled on her brother, the asura king Mahishasura. As Mahishasura was blessed with invulnerability to all men, the gods had sent goddess Durga, to fight and kill him. Thus, Mahishi began performing a fearsome set of austerities, and pleased the creator god Brahma. She asked for the boon of invulnerability, but Brahma said it was not possible so Mahishi planned and asked invulnerability to all men except by the son of Shiva and Vishnu (Both are male & no possibility to give birth to any one). He granted her the boon of ruling the universe and being invulnerable except by the son of Shiva and Vishnu. Since such a person did not exist, she thought she was safe and began conquering and plundering the world.
The gods implored Shiva and Vishnu to save them from this catastrophe. Vishnu found a possible solution to the problem. When Vishnu had taken on the Kurma Avatar, he also had to manifest himself as Mohini, the enchantress, to save the nectar of immortality (ambrosia or amrit) from the demons who were not willing to share it with the gods. If he became Mohini again, then the female Mohini and the male Shiva could have the divine child who would combine their powers and beat Mahishi.
Some versions give a slightly more detailed version of the union of Shiva with Vishnu. One version tells that the asura Bhasmasura had so pleased Lord Shiva with his austerities that Shiva gave him a boon of anything he wished. So Bhasmasura asked for the ability to burn to ashes anything which he placed his hand over. No sooner had Shiva granted this, than Bhasmasura ran after the god, threatening to turn him to ashes.
Shiva called to Lord Vishnu for help. He hide himself in a peepal tree as Bhasmasura ran here and there searching for the god. Vishnu became aware of the events, and decided that he would take the female form Mohini, "the Enchanting", and try to trump the asura's powers. When Bhasmasura saw Vishnu in this form, he was bewitched by her beauty. He earnestly tried to court her. So Vishnu instructed Bhasmasura to hold his hand over his head, and vow fidelity. With this act, Bhasmasura was reduced to ashes.
Vishnu found Shiva and explained the whole affair to him. Shiva asked if he too could see Vishnu in this female form. When Vishnu appeared thus, Shiva was overcome with passion, and united with her. The two gods thus became "Harihara Murthi", that is a composite form of Shiva and Vishnu as one god.
From this union, Lord Sree Dharma Sastha was born. He combined in himself the powers of Vishnu and Shiva. Lord Ayyappan is an incarnation of Lord Sree Dharma Sastha and Lord Ayyappan is a visible embodiment of their essential identity. Sri Ayyappa belongs to Pandya Royal Community. He was the head of a clan. It is believed Sri Ayyappa merged to sri dharma sastha. Lord Vishnu gifted the new-born deity with a little bejeweled bell necklace, so this god is called Manikandan. He is also Known as Dharma Shasthavu, Kerala Puthran.