When the Prophet ﷺ came to Medina, he found (the Jews) fasting on the day of 'Ashura' (i.e. 10th of Muharram). They used to say: "This is a great day on which Allah saved Moses and drowned the folk of Pharaoh. Moses observed the fast on this day, as a sign of gratitude to Allah." The Prophet ﷺ said, "I am closer to Moses than they." So, he observed the fast (on that day) and ordered the Muslims to fast on it.
أَنَّ النَّبِيَّ ﷺ لَمَّا قَدِمَ الْمَدِينَةَ وَجَدَهُمْ يَصُومُونَ يَوْمًا يَعْنِي عَاشُورَاءَ فَقَالُوا هَذَا يَوْمٌ عَظِيمٌ وَهْوَ يَوْمٌ نَجَّى اللَّهُ فِيهِ مُوسَى وَأَغْرَقَ آلَ فِرْعَوْنَ فَصَامَ مُوسَى شُكْرًا لِلَّهِ فَقَالَ أَنَا أَوْلَى بِمُوسَى مِنْهُمْ فَصَامَهُ وَأَمَرَ بِصِيَامِهِ