As the others have mentioned, you don't need to know the pen-and-paper rules to play and enjoy the game. If you're interested, it's definitely worth checking out, but it's not at all mandatory.
Most of the D&D games sold on GoG use either the AD&D ruleset or the 3rd edition ruleset. As official D&D products go neither ruleset is supported anymore, although 3rd edition remains incredibly popular to this day and there is plenty of third-party support and publications (just don't expect it to have the D&D brand). The Baldur's Gate series, Planescape Torment, and Icewind Dale 1 all use the AD&D ruleset. The Neverwinter Nights series, Temple of Elemental Evil, and Icewind Dale 2 are all based on the 3rd edition ruleset.
Physical copies of either edition are pretty hard to come by these days, and command a pretty hefty premium for second-hand copies since they've been out of print for some time. Fortunately due to the way the 3rd edition ruleset was licensed there are still some
very complete online resources available. I'm not aware of any similar resource for AD&D, however, so you may have a harder time getting ahold of those rules if you're interested.