Grammar is the system of a language. People sometimes describe grammar as the "rules" of a language; but in fact no language has rules*. If we use the word "rules", we suggest that somebody created the rules first and then spoke the language, like a new game. But languages did not start like that. Languages started by people making sounds which evolved into words, phrases and sentences. No commonly-spoken language is fixed. All languages change over time. What we call "grammar" is simply a reflection of a language at a particular time.
Do we need to study grammar to learn a language? The short answer is "no". Very many people in the world speak their own, native language without having studied its grammar. Children start to speak before they even know the word "grammar". But if you are serious about learning a foreign language, the long answer is "yes, grammar can help you to learn a language more quickly and more efficiently." It's important to think of grammar as something that can help you, like a friend. When you understand the grammar (or system) of a language, you can understand many things yourself, without having to ask a teacher or look in a book.
So think of grammar as something good, something positive, something that you can use to find your way - like a signpost or a map.