If you pick up the Player's Handbook for 5th Edition, there is literally a full page list of works of fiction that are recommended to immerse oneself in the fantasy mindset. These works cover quite a span of fictional universes, from Tolkien's The Lord of the Rings to Burroughs' John Carter of Mars to Pratchett's Discworld. Familiarizing yourself with any of these will give you a well of generalizable material to pull into your roleplaying experience.
As pointed out by some commentators above, if you want to get a feel for the particular setting of your world, you have to ask your DM. There are a few "official" settings for Dungeons and Dragons; Forgotten Realms is the flagship setting for 5th Edition, but Greyhawk, Dragonlance and Eberron remain popular and find support in the core rulebooks. Your DM may also opt to run a homebrew setting that draws on her own experiences in fiction but may have no specific source material.
There's also an important caveat to mention even if you are playing in a published setting like Forgotten Realms: you can't always assume the published setting is the same world you are playing in.
Ultimately, the Dungeon Master is the authority on the campaign and its setting, even if the setting is a published world.
Be careful when assuming things about the game world just because you read them in a published fiction. Your DM may not have read it, and most certainly not all of the other players will have read it, so it could cause friction at the table. If you ever want to incorporate major elements from the published setting that haven't come up in game yet, check with your DM to make sure you're on the same page.