And from those days on which it is legislated in the Sunnah to fast is the day of ‘Arafah and the tenth day of the month of Muharram – as per the hadeeth of Aboo Qataadah radi Allaahu ‘anhu that the Prophet sall Allaahu ‘alaihi wa sallam was asked about fasting the Day of ‘Arafah. He said:

It expiates for the past year and the coming one.

The past one – meaning that which has finished, because the Day of ‘Arafah is in the last month of the year. And (it expiates for) the coming one. So it expiates for two years.

And he was asked about fasting on the Day of ‘Aashooraa (the tenth of Muharram) – he said:

It expiates for the past year.

So it is lesser in reward than fasting the Day of ‘Arafah. And along with that it is befitting that (the person) fast the ninth along with the tenth because the Prophet sall Allaahu ‘alaihi wa sallam said:

If I were to remain (alive) until the coming year, I would certainly fast the ninth. [1]

Meaning – along with the tenth.

And because he commanded that a day before it or a day after it be fasted, to be different to the Jews – because the Day of ‘Aashooraa- – the tenth of Muharram – is the day on which Allaah saved Moosaa and his people. And He drowned Fir’awn and his people. So the Jews used to fast it, out of gratitude to Allaah for this tremendous blessing , that Allaah saved His army and vanquished the army of Shaytaan. He saved Moosaa and his people and destroyed Fir’awn and his people. So it was a tremendous blessing.

And therefore when the Prophet sall Allaahu ‘alaihi wa sallam arrived in al Madeenah, he found the Jews fasting the Day of ‘Aashooraa-, so he asked them about that. They said, “This is the day Allaah saved Moosaa and his people, and Fir’awn and his people were destroyed. So we fast it, out of gratitude to Allaah.”

So he said:

We have more right to Moosaa than you do. [2]

Why was this? Because the Prophet sall Allaahu ‘alaihi wa sallam and those with him had the best claim out of the people to the previous prophets.

Indeed those from the people who have the best claim to Ibraaheem are those who followed him, and this Prophet and those who believed. And Allaah is the Protector and Helper of the Believers.
[Soorah aale ‘Imraan (3) aayah 68]

So Allaah Messenger sall Allaahu ‘alaihi wa sallam had more right to Moosaa than the Jews did because the Jews disbelieved in him and disbelieved in ‘Eesaa and disbelieved in Muhammad.

So he fasted it and commanded the people to fast it, except that he commanded that they differ from the Jews – those who only fasted the tenth day – such that we fast the ninth, or the eleventh, along with the tenth – or (all) three.

Therefore some of the people of knowledge, such as ibn ul Qayyim and other than him,
mentioned that the fasting of ‘Aashooraa is of three categories:

1) that (the person) fast ‘Aashooraa and the ninth – and this is the best of the types

2) that he fast ‘Aashooraa and the eleventh – and this is less (virtuous) than the first

3) that he fast ‘Aashooraa alone. And some of the scholars disliked this because the Prophet sall Allaahu ‘alaihi wa sallam commanded being different from the Jews. And some of the scholars allowed this as a concession.

References:

[1] Reported by Muslim (1134) and ibn Maajah and Ahmad in his Musnad.
[2] Reported by al Bukhaaree (3943) and Muslim and Aboo Daawud.