Why does my urine smell like onions and garlic when I didn't eat either one?

Vitamins or meds? Urine is a byproduct of the kidneys filtration of the blood. It is common for urine that is concentrated to have a stronger odor. Increasing water intake helps with this. However, vitamins and certain medications can also give the urine a stronger odor.
Ate something else ! It is usually a function of what you ate. It may be that you ate something that has either garlic or onion hidden in the ingredients, as you know many of the time we eat preprepared food that we are not sure what's exactly in it. Also, sometimes a medicine can change urine smell. Provided that you've no signs of infection i.e. Frequency, pain, fever; begin your fbi work to find culprit food source.