The day of Ashura was a day that Quraysh used to fast during the pre-Islamic era, and the Messenger of Allah ﷺ used to fast it as well. When he arrived in Medina, he fasted it and ordered others to fast it. Then, when Ramadan was made obligatory, the fast of Ashura was left as optional. Whoever wished to fast it could do so, and whoever wished to leave it could do so.
حدثنا عبد الله بن مسلمة عن مالك عن هشام بن عروة عن أبيه أن
كان يوم عاشوراء تصومه قريش في الجاهلية وكان رسول الله ﷺ يصومه فلما قدم المدينة صامه وأمر بصيامه فلما فرض رمضان ترك يوم عاشوراء فمن شاء صامه ومن شاء تركه