Welcome to the king of all roleplay systems! D&D comes in several editions, some well-known settings, plus lots of semi-home-brew versions. Are you interested in one in particular edition or setting, or any and all? They have a lot in common, but each one emphasizes different aspects, such as combat, skills, story telling, character progression, world exploration, etc. As for buying books, first you need to know which edition, and then it depends on your GM. Some can handle complete newbies and provide information as needed, and some have even built spells and combat into the interface, so buying books is unneeded, especially at lower levels. Others expect players to understand how to manage your own combat and spells, and special abilities. As you acquire magic items and abilities, having a written reference is valuable. You might get by with library books to learn the basics while you decide. There are podcasts and videos that you can watch to get the idea of play, but every game is different because D&D is such a flexible system. I'm unable to advise on that, but others will likely chime in here. Welcome again!