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