What is 'Railroading' in D&D and Other TTRPGs?
If you are playing D&D 5th edition, you probably don't have many adventures that involve railroads, but you may have some that involve railroading. A term for how a game governs the interaction between players and stories, "railroading" is the act of ensuring the players stay on plot by use of game mechanics. It is the opposite of an "open-world" that features full exploration. In most games, there is a balance between railroading and open world aspects.
In D&D and other table-top role-playing games, a DM may railroad the characters in order to keep them on course for the story or map that they've devised. Railroading can take two basic forms: in-game railroading, such as when the DM sends an ancient red dragon to fly over the party and ensure they take the route the DM wants, and out-of-game railroading, which is when the DM simply dictates "You arrive in..." or "You set sail across the..."
Official campaigns can require a certain amount of railroading to keep the characters on script. After all, a campaign book cannot cover the entire world, and were player characters allowed, they could easily leave the designated roadmap and skip the adventure entirely.
When dealing with homebrew campaigns, DMs often have a lot more leeway and the amount of railroading can come down to style and preparation. A good DM tends to balance between these two extremes. Many players dislike too much railroading because they don't feel as if they are playing their characters so much as riding in someone else's car, but a campaign where players are constantly going off in directions the DM hasn't planned for can quickly become devoid of the intricate storylines that can make D&D so addicting.