It is reported in the Sahih of Imam Al-Bukhari and other authentic collections of hadith that the Prophet (peace and blessings be upon him) and his Companions used to fast on the 10th day of Muharram while they were in Makkah (before the hijrah).
It was a day on which people of Makkah used to change the covering (kiswah) of the Kabah. Quraysh also used to fast on this day. (Al-Bukhari, hadith 1489 and 1760)
After the hijrah when the Prophet (peace and blessings be upon him) came to Madinah, he found that the Jews of Madinah also used to observe this day with fasting. The Prophet (peace and blessings be upon him) asked them the reason of their fasting on this day. They said, “This is a blessed day. On this day Allah saved the Children of Israel from their enemy (in Egypt) and so Prophet Musa fasted on this day giving thanks to Allah.” The Prophet (peace and blessings be upon him) said, “We have more claim to Musa than you.” He fasted on that day and commanded Muslims to fast on this day. (Al-Bukhari, hadith 1865)
In another report it is mentioned that Jews of Madinah used to hold a feast on this day. The Prophet (peace and blessings be upon him) told his Companions to fast instead. (Al-Bukhari, hadith 1866)
Ashura fasting was obligatory (fard) in the beginning. In the second year of hijrah (624 CE) when Allah’s command came that Muslims should fast the whole month of Ramadan, the Prophet (peace and blessings be upon him) then sent someone to announce to people that fasting of Ashura had become voluntary (nafl). This indicates that whosoever wishes to fast, may fast and whosoever does not want to fast, there will be no blame on him/her.
Imam at-Tirmidhi mentioned that ibn Abbas (may Allah be pleased with them both) used to say that we should fast on two days: the 9th and 10th of Muharram to distinguish ourselves from the Jewish community. (At-Tirmidhi, Hadith 686)
Ibn Abbas also quoted the Prophet (peace and blessings be upon him) as saying, “If I live next year, I shall also fast on the 9th day.” (Musnad Ahmad ibn Hanbal, hadith 2002)
There is a great reward in fasting the day of Ashura. There are many hadiths that mention its blessings and virtues. It is good to fast on this day, although it is not obligatory.
"Significance of Fasting the day of Ashura" - Muzammil Siddiqi