Exactly the same as other words.
The thing about 擬音語{ぎおんご} and 擬態語{ぎたいご} (strictly speaking "onomatopoeia" only describes 擬音語, though it's commonly used for both) is that to Japanese speakers, they're just words like any other. How did you learn helter-skelter, mishmash, or bang?
In other words, how people learn language, and why they agree on the more or less arbitrary relationship between sound and meaning, are fascinating questions that are far too big for this post, so for our purposes I'll just say "the usual methods". That includes manga (and manga use a lot of them, for roughly the same reasons American comics use a lot of "Bam!" and other words to convey sound and motion), but also children's books, deliberate education in school, and especially hearing the everyday conversations of adults.
Bonus fun fact: it's not quite true that there's no pattern to how they're formed. Tolkien was a big proponent of the idea, now mostly out of fashion, that there is a strong relationship between the sound of a word and its meaning, and there is modern evidence of this as well, at least in some contexts. Specifically in Japanese, one volume of ダーリンは外国人 (a slice-of-life comic with some interesting linguistic moments) explored the idea that words like ゆれる (to sway or wobble) may actually come from ゆるゆる ("wobble-wobble"), not the other way around, and that may provide insight into the formation of language; ゆるゆる "sounds right" for that activity in a way that ピカピカ wouldn't, so maybe language is mostly made of progressively more complex/obscure onomatopoeia. Not very scientific, perhaps, but intuitively compelling and fun to think about. If true, these words may be easier to learn because the relationship between sound and meaning is clearer, and therefore more common in children's books and conversation, and less so with adults.
i was wondering where people actually learn them?
みんなが日々の生活の中で使っているので…。(特に大阪人の会話なんか擬音語・擬態語だらけ。)