Just because something works, doesn't mean it is good for them.
They used to put low levels of anti-biotics in chicken feed because it caused the chickens to grow faster. This has caused drug resistant bacteria, which are now found in virtually every commercial poultry abattoir around the world. Most commercial poultry farms are contaminated with drug resistant bacteria too.
They also used to feed cattle, pigs and poultry with animal meal made from cow, pig and poultry by-products. This lead to mad Cow Disease and various other viruses that infect pigs, poultry and cattle.
These two situations were thought to be good ideas at the time because they increased productivity but are now illegal due to the side effects.
Fish never evolved to eat terrestrial plant matter and certainly not terrestrial plant bulbs like onions and potatoes. Feeding onion and onion relatives (spring onion, shallots, leeks and garlic) to fish is not natural, and although it doesn't kill them directly, it could cause problems to their health. Most animals can't tolerate onions or garlic and it does long term damage to their organs, so there is a possibility it will adversely affect fish. Until further study is done on this subject, people should be wary of using garlic in their aquariums.