Knowing the rules for a game is easily one of the most important parts of learning how to play. But first thing you need to know is what edition of the game to play. Dungeons and Dragons has been around since 1974 (yeah, it’s that old) that there have been several revisions and redesigns over the years. The ideal starting point is the most recent 5th Edition that most game stores and hobby shops currently sell the books to.
Of course, rules aren’t as important as the imagination and creativity that everyone brings to the table. It’s more important to have fun than it is to follow the rules, so don’t be afraid to try something new.