A man asked Anas, "What did you hear from the Prophet (ﷺ) about garlic?" He said, "The Prophet (ﷺ) said, 'Whoever has eaten this plant should neither come near us nor pray with us."
Sahih al-Bukhari Book 10, Hadith 247