A Quranic Command: Eat of the Good Things that Allah has Provided
ALLĀH commands;
يَا أَيُّهَا الَّذِينَ امَنُواْ كُلُواْ مِن طَيِّبَاتِ مَا رَزَقْنَاكُمْ وَاشْكُرُواْ لِلّهِ
O believers! Eat of the lawful things that WE have provided you with, and be grateful to ALLĀH,
This is a command to the believers in particular, after a command addressed to all of humanity, for they are the ones who really benefit from the commands and prohibitions, because of their faith. Here ALLĀH enjoined them to eat of the good things that HE has provided, and to be grateful to ALLĀH for HIS blessings, by only using them in ways that will bring them closer to HIM. This is the same command that HE gave to the Messengers, when HE said:
یَـٰۤأَیُّهَا ٱلرُّسُلُ كُلُوا۟ مِنَ ٱلطَّیِّبَـٰتِ وَٱعۡمَلُوا۟ صَـٰلِحًاۖ
O Messengers, eat of that which is wholesome and do righteous deeds… (23: 51)
In this verse, “gratitude” refers to doing righteous deeds. Here, ALLĀH did not say “whatever is lawful (halal)” because ALLĀH has permitted to the believer all good things that HE has provided that are free of any negative consequences. Moreover, his faith will keep him from consuming anything that is not his.
إِن كُنتُمْ إِيَّاهُ تَعْبُدُونَ
if it is indeed HE Whom you worship.
That is, then give thanks to HIM. This indicates that the one who does not give thanks to ALLĀH is not worshipping HIM alone, whilst the one who does give thanks to HIM is worshipping HIM alone and has done what HE enjoined. It also indicates that eating good things is the means of doing righteous deeds and of them being accepted. The command to give thanks comes immediately after mention of the blessing, because gratitude protects existing blessings and brings blessings that are missing, whereas ingratitude drives away blessings that are missing and causes existing blessings to be lost.
{Tafsir As-Sa’di}
Eating from pure sources is a cause for the acceptance of supplications and acts of worship, just as eating from impure sources prevents the acceptance of supplications and acts of worship, as mentioned in a Hadith recorded by Imam Ahmad, that Abu Hurayrah (may ALLĀH be pleased with him) said that ALLAH’S Messenger (ﷺ) said:
“O people, ALLĀH is purely good, and HE only accepts what is purely good. Verily, ALLĀH has commanded the believers as HE has commanded His Messengers. ALLĀH said: O Messengers, eat from wholesome foods and act righteously, for I know what you do (23:51). And ALLĀH said: O you who believe, eat from wholesome food WE have provided for you,” (2:172).
Then, the Prophet mentioned a man who traveled far, becoming disheveled and dusty, and he raised his hands to the sky, saying, “O Lord! O Lord!” Yet his food is unlawful, his drink is unlawful, his clothing is unlawful, and he is nourished by the unlawful, so how can he be answered?
{Tafsir Ibn Kathīr}