Welcome to the game! To start you'll need a few things, and can expand from there.
Here is the basic rules, as well as basic Dungeon Master (DM) rules. They are available in a web based or printable format.
Here is player sheets and some premade characters if you don't feel like going through the process of creating a character to begin with.
You'll also need some dice. Chessex makes some cheap dice to start with.
Here is a nice DM screen/cheat sheet that has information you'll probably need at a glance while running the game.
Think about getting the Starter Set . It comes with a pre-written adventure module, basic rules, premade characters and a single set of dice for a reasonable price.
After that watch Matt Colville on YouTube. He has a very nice series called "Running the Game" that is filled with information and tips, and starts off with a complete beginner in mind.
If you want to start getting serious I would recommend each player getting a Players Handbook . This has information for creating a character, rules for playing the game and other useful information.
As a DM you'll need the Dungeon Masters Guide and the Monster Manual . This has information and rules on running the game, and stat blocks for monsters. You can get all three of these mentioned books in PDF format if you wish, but I find physical copies to be easier to quickly reference.
Here is a website that has infromation I've previously mentioned in a nice web format. It is not a replacement for the books I have mentioned, as some of that information isn't on here.
After all of this you may want to get Volo's Guide to Monsters and Xanathars Guide to Everything . This has even more monsters, player races and variant rules you can add into your game. These are not mandatory but I find them to be a nice addition to the game.
You may decide to start using battle mats and miniatures, these add a lot to the game by making combat more visual and tactical. To start you could do something as simple as printing off squares on paper . This last part can add a lot of expense to the game and isn't mandatory, but most people prefer to use them.
That's a good introduction. There's resources on Reddit to learn the game, including /r/DnD, /r/DMAcademy and /r/DNDBehindTheScreen as well as YouTubers such as Matt Colville, Matt Mercer/Critical Role, Nerdarchy and Web DM.
This is a prewritten message that may not completely apply to you, but it summarizes a lot of the information that a beginner player or DM could use.
Starting off, buy the Starter Set on Amazon, as well as a bag of dice .
I'd recommend finding one more person. That way you would have three players and one game master. But you can easily play with two players and one game master.
This is the free rule set that Wizards of the Coast provides. This will give you bit more than the Starter Set does in terms of how the game runs.
This is the free rules for game masters that they provide as well. This will help whoever runs your game.
This is where you download 5th Edition Character Sheets for players to use. The starter set comes with pre-made characters, but at some point you'll want blank sets that you can more easily mark, take notes on, and modify as characters progress.
And that's all you need. Getting started, the starter set and a bag of dice will work right out of the box (the set comes with one set of nice, but it's MUCH better if everyone has their own, and sometimes you need duplicates of the same kind of dice). The free PDFs the publisher provides are there to give you a bit more meat beyond what the starter set allows.
With that, which is really a minimal investment, you can find out if you like D&D. If you do, then go buy the Player Handbook and the Monster Manual (but seriously, wait to get these until after you've played some). That's it! Anything else is just extra.
Welcome and happy exploring!