Aishah reported that the day of Ashura was a day the Quraysh used to fast during the days of ignorance, and the Messenger of Allah ﷺ used to fast it then as well. When the Messenger of Allah ﷺ arrived in Medina, he fasted it and commanded others to fast it. Then, when fasting Ramadan was made obligatory, that became the obligation, and the day of Ashura was left optional. Whoever wished, fasted it, and whoever wished, left it.
كان يوم عاشوراء يوما تصومه قريش في الجاهلية، وكان رسول الله ﷺ يصومه في الجاهلية، فلما قدم رسول الله ﷺ المدينة صامه وأمر بصيامه، فلما فرض رمضان، كان هو الفريضة، وترك يوم عاشوراء، فمن شاء صامه، ومن شاء تركه.
Malik narrated it in al-Siyam (33) from Hisham bin Urwa, from his father, from Ayesha, the wife of the Prophet ﷺ, and he mentioned it. Bukhari narrated it in al-Sawm (2002) from Abdullah bin Maslama, from Malik, with the same chain, similarly. Muslim narrated it in al-Siyam (1125) through another route from Hisham, with the same chain.