The day of Ashura was a day that Quraysh used to fast during the age of ignorance, and the Messenger of Allah ﷺ used to fast it then as well. When the Messenger of Allah ﷺ came to Madinah, he fasted it and ordered that it be fasted. Then, when Ramadan was made obligatory, that became the obligation, and the day of Ashura was left aside. Whoever wished fasted it, and whoever wished left it.
حدثني يحيى عن مالك عن هشام بن عروة عن أبيه
كان يوم عاشوراء يوما تصومه قريش في الجاهلية وكان رسول الله ﷺ يصومه في الجاهلية فلما قدم رسول الله ﷺ المدينة صامه وأمر بصيامه فلما فرض رمضان كان هو الفريضة وترك يوم عاشوراء فمن شاء صامه ومن شاء تركه