Ayesha reported,

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.

Bukhari 4504

Sahih

حدثني محمد بن المثنى حدثنا يحيى حدثنا هشام قال أخبرني أبي

عن عائشة رضي الله عنها قالت

كان يوم عاشوراء تصومه قريش في الجاهلية وكان النبي ﷺ يصومه فلما قدم المدينة صامه وأمر بصيامه فلما نزل رمضان كان رمضان الفريضة وترك عاشوراء فكان من شاء صامه ومن شاء لم يصمه

البخاري 4504صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Tafsir
Chapter
O you who believe, fasting has been prescribed for you as it was prescribed for those before you, that you may attain taqwa
Numbering
Darussalam 4504
Bukhari 4504