Abu Ayyub said that when food was brought to the Prophet (ﷺ) he ate some of it and sent him what was left over. One day when he sent him a dish from which he had eaten nothing because it contained garlic, he asked him whether it was unlawful and he replied, “No; but I dislike it because of its odour;” so he said, “I dislike what you dislike." Muslim transmitted it.
Source: sunnah.com
Other translations
Arabic
وَعَن أَيُّوب قَالَ: كَانَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِذَا أُتِيَ بِطَعَامٍ أَكَلَ مِنْهُ وَبَعَثَ بِفَضْلِهِ إِلَيَّ وَإِنَّهُ بَعَثَ إِلَيَّ يَوْمًا بِقَصْعَةٍ لمْ يأكُلْ مِنْهَا لأنَّ فِيهَا ثُومًا فَسَأَلْتُهُ: أَحْرَامٌ هُوَ؟ قَالَ: «لَا وَلَكِنْ أَكْرَهُهُ مِنْ أَجْلِ رِيحِهِ» . قَالَ: فَإِنِّي أَكْرَهُ مَا كرهْت. رَوَاهُ مُسلم
sunnah.com