"He thought about eating onion."
Translation:On pomyślał o jedzeniu cebuli.
Well, I'm afraid it's hard to exclude the grammatical mistakes here because only "On pomyślał" makes any sense...
In Polish, most of the verbs have a noun form which translates to an English -ing form used as a noun. pływać - to swim, pływanie - swimming. gotować - to cook, gotowanie - cooking. And the fun thing is, that 'eating' = jedzenie, is the very same word that also means 'food' (general meaning of 'food', not 'meal', this is 'posiłek').
Because of this, if the onion was somehow personified, it could be "onion's food". If we changed the onion to an animal, like a chicken, "o jedzeniu kurczaka" could seriously be considered "about chicken's food", although it's n times less probable interpretation.
Then, we can have some perfective/imperfective choices: myślał vs pomyślał - he was thinking vs he thought (a thought appeared in his mind)
and jedzeniu/zjedzeniu - simple 'eating' without paying any attention to the results, or 'eating the whole onion'
If we were to think of another construction, I'd suggest "On pomyślał o tym, żeby zjeść cebulę". But I guess that translates to English in the same way.