Anything that grows under the ground is not offered to God. According to Vedic science, anything which is grown under the ground is Tamasik in nature and produces sluggishness, heaviness and extreme aggressiveness.
Not only onion, all food products grown under the ground are not offered to God and are not supposed to be eaten during spiritual fasts. People who are spiritually oriented like monks, rishi munis avoid underground food altogether. Some people try to convert Tamasik food into Satvik food by slow heating them or by sprouting them or by soaking them in water. That is one reason why boiled potato is eaten during Vrat.