The story of Shunahshepa is famous because it is an attempted human sacrifice to a Vedic deity.
There are other mentions of attempted human sacrifice in Hindu scriptures. For example, in the Mahabharata, king Jarasandha tried sacrificing some other kings to another Vedic deity.
For the record, human sacrifice, in the sense of sacrificing humans like animals in Yajnas, is prohibited in Hinduism.
We can see that from the story of Shunahshepa told in the Aitareya Brahmana of the Rig Veda:
Four priests were called to conduct the sacrifice: Ayasya (the udgatr), Jamadagni (the adhvaryu), Vashistha (the brahman) and Vishvamitra (the hotar). However, all of them refused to bind Shunahshepa to the sacrificial post. Ajigarta then offered to bind his son for another hundred cows. Rohita accepted the offer, and Ajigarta bound Shunahshepa to the post. However, the priests refused to slaughter him. Ajigarta then offered to sacrifice his own son in exchange for another hundred cows. The prince agreed to his demand. As Ajigarta readied to kill his own son, Shunahshepa prayed to the Rigvedic deities. With his last hymn, which invoked Ushas (the deity of the dawn), his bonds were loosened and King Harishchandra was also cured of his illness.1
Vishvamitra, one of the priests, offered to adopt Shunahshepa as his eldest son. Reviling his own father Ajigarta as a Shudra, Shunahshepa agreed. Vishvamitra gave him the name Devarata ("deity-given").
So, the attempted sacrifice of Shunahshepa was a sin, and his father did so out of greed for cattle.
My question is, why did Varuna Deva tell Harischandra that he should sacrifice his son to him, when human sacrifice is not enjoined in the Vedas?
Also, why did Ushas, the Rig Vedic deity of the dawn, save Shunahshepa?