It is narrated from Sayyiduna Ali (may Allah be pleased with him) that he said: "When Sayyiduna al-Hasan (may Allah be pleased with him) was born, he named him Hamzah; then when Sayyiduna al-Husayn (may Allah be pleased with him) was born, he named him after his paternal uncle Ja'far." He said: "Then the Messenger of Allah (peace and blessings be upon him) called for me and said: 'Indeed, I have been commanded to change the names of these two.' I said: 'Allah and His Messenger (peace and blessings be upon him) know best.' So he (peace and blessings be upon him) named them Hasan and Husayn."
Ishaq bin Rahwayh (may Allah have mercy on him) narrated it in his Musnad from Zakariyya bin Adi (may Allah have mercy on him).
Related hadith on this topic