One person is the "dungeon master". They are sort of like a referee. They typically make the initial pitch of the game to the other players. That's something like "I want to do a game about defending a town from zombies" or "wouldn't it be cool to be like bank robbers in a fantasy world?"
The group then comes up with characters they want to play. DND has rules for what sort of powers and abilities characters have. This is mostly captured by "character class" (fighter, wizard, paladin, etc). You might say "I want to hit things with a sword so I'll be a fighter " or "I want to learn magic so I'll play a wizard."
Unlike playing a board game, you also come up with some story bits for your character. So you might play a wizard who's fresh from wizard school and turned to bank robbing to pay off student debt. Or an old wizard that needs money to pay for expensive magical healing. It is pretty wide open, though not totally open. Some new players will try to do like "my dad is the king and my mom is an angel and I can fly and...", and forget to sync their story with the rules parts. And ideally whatever story idea you have hooks into the pitch.
Once you've done all that, you get together as a group (virtually or in person). The DM (dungeon master) will describe the initial scene. "You're just kicked open the door to the bank office. Your tip said it was going to be empty, but two elves are sitting behind a large desk. They jump up, startled and surprised. The room is ostentatious. Marble floors. Stained glass floor to ceiling windows. Magical lights hanging from the fifteen foot ceiling." The dm will probably ask what you do.
Note that the dm generally describes the scene and characters that aren't being played by one of the players. The players in DND generally only control their specific characters. In dnd a player could not be like "the elf runs away in a panic!" or "suddenly all the lights go out!". Only the dm can declare what the world and its non-player inhabitants do. The players control their characters only. (non DND RPGs may differ on this point)
A player may ask questions. "are the elves armed?"
The dm may answer. "you don't see any obvious weapons".
The dm may ask you to roll dice to determine if you succeed at something, notice something, or know something. "Roll perception for me to see if you notice anything else."
When you check if you succeed at something like that in DND you roll a 20 sided die, and often add something to the result based on your character. A smart character has a bonus for knowing stuff, and a strong one to physical challenges, as examples.
"That's a 17 on perception? You notice a magical wand on the desk, half covered by papers, and the elf glanced at it."
Players may declare they're doing something. "I want to lunge for it before the elf picks it up!"
The dm may call for a roll to see how that goes, and narrate the outcome.
This process of the dm describing the scene and the players asking questions / taking actions continues. If a fight breaks out, combat in DND has a lot of specific rules for determining if attacks hit or miss, if someone is taken out of the fight, and so on.
Usually people play for a few hours at a time, and pick up the story the next time they play. So the first session might be trying to rob the bank vault and getting in a fight with the staff, the second might be cracking the vault and escaping, the third might be a showdown with the head of security with a horseback chase. Much of this will be made up by the DM. They may not have expected the players to steal horses and ride into the desert, but if that's what the players do they will make something up. This is the big appeal of RPGs over videogames. You can do anything the group thinks is cool. It doesn't need to be scripted ahead of time.
Much of this as I've described it applies to non-dnd RPGs, too. DND has a lot of very specific things about it I've kind of glossed over. It has very idiosyncratic combat and magic systems, for example. You'll hear people talk about "roll for initiative", "saving throw", "critical hit" and more. Those are details for dnd's rules.
Honestly DND is kind of a bad first rpg. It's very popular but it's also extremely janky, and only does adventuring day fantasy at all well. Games about political intrigue or social conflict don't do well in DND specifically because it doesn't really have detailed rules for them. It's also pretty harsh on allowing players to be creative compared to other games.