Player's handbook, Dungeon Master's Guide and Monster Manual
These three books are the "core books" for Dungeons and Dragons 5e.
This is not an in depth review of these books as they are so fundamental. But I think it is good to mention them at least, before I go any further with the more cool-but-not-so-neccessary-books.
The Players Handbook  (PHB) contains all the basic rules that the player needs to know to play the game, equipment, spells, character options, feats, races, backgrounds and everything to put it all together.
The book is a reference for everyone at the table, both for the players and the dungeon master, and it is a good idea to become familiar with it. So take your time and scroll through the book a little now and then.
PHB is the only neccessary book if you only intend to attend as a player.
Dungeon Master's Guide
The Dungeon Master's Guide  (DMG) contains ton of magical items, variant rules and greate tips on how to DM. I'm not sure if I would classify this book as neccessary as I think it would be possible to play as a DM without even open this book. But it will for sure simplify your role as a DM.
The parts I found most useful is tips on how to balance an encounter which is really hard, especially for new DMs like myself. All magical items with nice lore and description is also fun to scroll through and gives you inspiration for your upcoming adventures. How more advanced mechanics work and all these random tables (e.g. treassure tables) that let you create a more dynamic game will also help you a lot.
The Monster Manual  (MM) contains several hundreds of monsters that you could encounter on your adventures. Every monster has a stat block and often a descriptive text about the monsters life and surroundings. MM is a must have to DM's but could also be useful for some players who has the character class Druid as they could transform into animals and need to have the stat block available.