It is narrated from Aisha (may Allah be pleased with her) that she said: In the days of ignorance, the Quraysh used to fast on the day of Ashura, and the Prophet (ﷺ) also used to fast. When the Prophet (ﷺ) came to Madinah, he also fasted on that day and ordered the people to fast on that day. When fasting in Ramadan was made obligatory, these (fasts of Ramadan) became obligatory and he abandoned (the fast of the day of Ashura), and said: "Whoever wishes may fast on this day, and whoever wishes may leave it."
Hadith Referenceمسند الإمام الشافعي / كتاب الصيام / 629
Hadith Takhrijاخرجه البخاری، الصوم، باب صوم يوم عاشوراء (2002)۔