By listening and copying as children, and then spending the rest of our lives knowing instinctively 'what sounds right', but not necessarily 'why' it sounds right.
English grammar is not taught in schools in English-speaking countries. In fact, 95% of the people in London, New York or Sydney have no idea what a gerund or an infinitive is : if you asked the vast majority of native speakers about verb patterns - even the most educated ones - they wouldn't have a clue what to answer. And yet we know what's wrong and what's right simply from experience.
I don't know if you've noticed, but there are two kinds of answers that you get from native speakers on this site. Teachers, and people who have an in-depth knowledge of other languages, will give you explanations using grammatical terminology. Meanwhile, other native speakers will give you correct answers and appropriate examples, but not be able to tell you why something is right or wrong. Some of these might even say 'I can't tell you about the grammar'.