You can learn it from classes, from writer's groups, from a mentor. Probably you'll learn it from all of the above. But if you are going to be a writer you must be utterly ruthless in your pursuit of what you need because that knowledge is the only thing that is going to separate you from the hordes who can speak and think and write in English but who no one but their friends and mothers want to read. Fiction is a luxury. It isn't like food, it doesn't nourish the body, keep it warm or safe or dry.
Fiction is pretty important to a lot of people, but it comes after the groceries.
You've got to do something to make the reader want to read you. Craft teaches you how to control a reader's experience. And that's what you want to do. Craft comes in a couple of parts. The easiest is grammatical.