From Sahih Bukhari (Hadith 856):
Narrated `Abdul `Aziz: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
Reference: Bukhari 856