Updated: Dec 13, 2020
As with anything, they say learn the rules before you break them. I believe that is essentially true for anything you care to do well. When it comes to D&D it certainly helps to know the rules. It's also useful to have played more than one Table-Top RPG and learned the ins and outs of various systems. Having some breadth of understanding of various systems and their game mechanics goes a long way to breaking the rules of any one system. Being exposed to a variety of ways of thinking about the subject assists you in making judgment calls that make sense, narratively. But in the end it comes down to this: The rules are just a tool. D&D is just a game. And the game rules themselves give you, the DM carte blanche to mess with them. The DM's Guide states clearly on page four,
The D&D rules help you and the other players have a good time, but the rules aren't in charge. You're the DM, and you are in charge of the game. That said, your goal isn't to slaughter the adventurers but to create a campaign world that revolves around their actions and decisions, and to keep your players coming back for more! If you're lucky, the events of your campaign will echo in the memories of your players long after the final game session is concluded.