Quraish used to fast on the day of 'Ashura' in the Pre-Islamic period, and Messenger of Allah ﷺ too, used to fast on that day. When he came to Medina, he fasted on that day and ordered others to fast, too. Later when the fasting of the month of Ramadan was prescribed, he gave up fasting on the day of 'Ashura' and it became optional for one to fast on it or not.
كَانَ يَوْمُ عَاشُورَاءَ تَصُومُهُ قُرَيْشٌ فِي الْجَاهِلِيَّةِ وَكَانَ رَسُولُ اللَّهِ ﷺ يَصُومُهُ فَلَمَّا قَدِمَ الْمَدِينَةَ صَامَهُ وَأَمَرَ بِصِيَامِهِ فَلَمَّا فُرِضَ رَمَضَانُ تَرَكَ يَوْمَ عَاشُورَاءَ فَمَنْ شَاءَ صَامَهُ وَمَنْ شَاءَ تَرَكَهُ