Onion and garlic are tamasic food which are considered detrimental to mind and body. They affect the reasoning power of brain and make the body dull and lazy. So it's advised that people should refrain from consuming onion and garlic. In religious scriptures like Gita, Manusmiriti people are strictly stopped from eating garlic and onion.
"Foods that are too bitter, too sour, salty, hot, pungent, dry and burning are dear to those in the mode of passion. Such foods cause distress, misery and disease." (Bhagwat Gita 17:9)
tamas tv ajñana-ja viddhi mohana sarva-dehinam pramadalasya-nidrabhis tan nibadhnati bharata (Bhagvad Gita 14:8)
"O Arjun, tamo guna, which is born of ignorance, is the cause of illusion for the embodied souls. It deludes all living beings through negligence, laziness, and sleep."
krodhad bhavati sammoha sammohat smiti-vibhrama
smiti-bhranshad buddhi-nasho buddhi-nashat praashyati ( Bhagwat Gita 2:63)
"Anger leads to clouding of judgment, which results in bewilderment of the memory. When the memory is bewildered, the intellect gets destroyed; and when the intellect is destroyed, one is ruined".
In Manusmirti 5:5 it' stated:
lasuna gñjana caiva palau kavakani ca
abhakyai dvijatinamamedhyaprabhavani ca
"Garlic, leeks and onions, mushrooms and all that proceeds from impure things are unfit to re eaten by twice-born men."
Again on 5:19 eating garlic and onion etc is a reprehensible act.
chatraka vivaraha ca lasuna gramakukkuam
palau gñjana caiva matya jagdhva pated dvija
"The mushroom, the village-pig, garlic, the village-cock, onions and leeks,—the twice-born man eating these intentionally would become an outcast".
• Tamo guna is the opposite of sattva guna. It causes doze, idleness, inebriety, chaos, and gambling. Those who often consume are deprived of distinguish what is right and what is wrong, moreover, they begin to behave in infra-dig way. They lose interest in fulfilling their duty as they feel lethargic. They keep on falling into the pit of ignorance. Their ignorance entail them to ill manners
• When the sharpness of intelligence is hazed, it steers to the confusion into the memory and it results in the harm the ability of understanding. As a matter of fact the intellect is the innermost source of guidance when it gets destroyed, he is ruined. In this manner, the path of descency and divinity is blurred and impiety, ignorance and irreligiousness prevail.
• Since these things are prohibited and highly disliked in scriptures, and the person who consumes them commit reprehensible act. Therefore, according to scriptures he should be out cast as the punishment for this consumption until he abstains himself from taking them.
P.S: Thanks to my friend Mr Saghir Ahmad alias Raju who is a scholar of these scriptures helped me.