The style of a game campaign mirrors the fictional genres it is based on. The original Dungeons & Dragons was inspired by two strands of fantasy. The first was the fantasy adventures of Robert E. Howard, Jack Vance, Edgar Rice Burroughs, and Fritz Leiber — tales of roguish wanderers more or less stumbling across situations and resolving them with courage and steel (in the case of Burroughs's John Carter, he's a noble wanderer).
In short, they were a series of what gamers would call "random encounters." In "Red Nails" Howard's Conan is fleeing an enemy army (with the inevitable beautiful girl in tow), finds a lost city in the jungle, gets involved in the endless bloody feud of the inhabitants, fights a bunch of people, and eventually leaves. In The Eyes of the Overworld, Vance's Cugel is trying to bring a magical lens back to the wizard who sent him halfway across the planet. He goes from city to city, attempting to con the locals, but only sometimes succeeding.
Us professional writer types have a professional writer-type word for that kind of fiction: "picaresque." The term comes from the Spanish word picaro, or rogue. A picaresque story is literally a rogue's journey from one self-contained situation to the next. Us professional game designer types have a professional game designer-type word for that kind of roleplaying adventure: "sandbox." In a sandbox campaign, the gamemaster (or game designer) has created a setting with various monsters, conflicts, rumors, intrigues, and mysteries. The characters can explore the setting and choose which hooks to follow up. (Like kids playing in a sandbox, hence the name.)
The second strand of fantasy inspiring D&D was, of course, Tolkein's The Lord of the Rings. This has become the template for a whole subgenre: the quest fantasy. A quest fantasy differs from a picaresque one in that the heroes have a particular goal, and all the events of the journey (well, most of them) relate directly to accomplishing that purpose.
The Fellowship of the Ring fight various monsters and escape deadly perils, but nearly all of them are either minions of their terrible enemy Sauron (and his ally Saruman), or evil beings drawn to the power of the Ring Frodo is carrying. At no point do they wander into a village and try to cheat the local headman out of the price of a fancy dinner, or stop on an island where iron-skinned giants turn captives into weird shrunken dolls.
Naturally, the quest has its own reflection in roleplaying. It's a standard way to motivate the characters, and thus their players. The gamemaster can assign them a quest, and then throw obstacles at them until they accomplish it. It's especially popular as the "spine" for an extended series of episodes on the road.
The two approaches have their own strengths and weaknesses.
A sandbox encourages player agency. They get to decide what the characters' goals are going to be. Ovethrow the tyrant? Put down the rebels? Defeat the evil cult? Stop the pirates? Join the pirates?
This agency and the lack of an obvious "story plot" can give the players a sense that their characters are adventuring in a real place and interacting with real people, whose lives don't stop when the heroes aren't around. But there's a disadvantage: the players may be paralyzed by indecision. What should we do? Too many choices!
Another problem common to sandboxes is that the player characters are likely to be bit players. After all, in the real world none of us are the most powerful people, so a band of random adventurers probably won't be the greatest warriors or magicians in the game setting. This can lead to the heroes getting their butts handed to them too many times, creating frustration for the players.
Finally, sandbox settings reward exploration and taking notes. The heroes can learn about the game world, form connections with NPCs, and uncover secrets — but players sometimes have trouble remembering the names of the other PCs, let alone that rumor they heard about the innkeeper three weeks ago. They may want to just show up and play, without memorizing the members of the ruling oligarchy and their ancient rivalries. Meanwhile the gamemaster has put so much damned work into his setting and wants to make sure the players can appreciate his genius! What do you mean you don't remember that House Foo has always been the deadly enemies of House Bar? I told you only six sessions ago! That's why the innkeeper betrayed you! He had green eyes, which obviously means he's descended from House Foo! I told you he had green eyes when you ordered your drinks!
By contrast a quest has one goal. Find/destroy/steal/activate the Magical Thingy, or kill/rescue/locate the Chosen One from the prophecy, or whatever. That keeps the players focused, but it also means that if they don't really want to do the quest, they're out of luck. It also promotes the feeling that the setting is simply the stage for their story rather than a living world.
The biggest single problem with a quest is that it can lead to "railroading." The gamemaster has come up with a series of encounters on the way to the big climax, and by God the players are going to have those encounters. If they come up with a clever way to skip ahead to the end, the gamemaster may try to thwart them in order to keep things "on track" rather than reward their creativity. I'm sorry, a storm comes up and blows your ship back to Portville. Looks like you'll have to take the Dragon Road through the Haunted Forest after all. Oops, an early snow has closed the mountain passes. The only way you can go is the Dragon Road through the Haunted Forest. Your teleport spell doesn't work. Just follow the damned road already!
Despite their pitfalls, neither approach is wrong. I have used both structures in games with success. Different games may work better with one structure or the other: certainly a "low fantasy" Robert E. Howard-style game is a natural match for a sandbox structure (though even Conan went on a few quests in his time; see The Hour of the Dragon for one example). And if you're running a Tolkein-influenced game a quest is practically mandatory. Science fiction games about scruffy merchants or mercenaries lend themselves to sandboxing, while young Space Knights can fly off on an intergalactic quest.
Until recently I would have said that horror games are a poor match for the sandbox style; after all, a horror story typically encourages a sense of mounting menace until the source of the horror is finally revealed. It's a quest, except that the object of the quest is scary and horrible. But recent game sourcebooks like The Armitage Files or The Dracula Dossier have shown how to use a sandbox style structure for horror adventures.
I've seen first-hand that the different structures appeal more to different types of players. Players who like to feel as though they're in a fantasy novel always enjoy a quest, while the ones who constantly "play tourist" in your game world will have fun in a sandbox. The "Method Actor" players who like acting out their interactions can go for either: a quest allows heroic sacrifices, betrayal, and all the drama of world-shaking events; but a sandbox lets them use all the stuff they put on that long character backstory page.
Players who just want to fight will probably prefer the clear goals of a quest, although if there are others in the party willing to keep track of the minutiae of the sandbox the butt-kickers will happily let them decide who the party's going to fight this week. "Strategist" players may appreciate the opportunity to understand and manipulate a sandbox setting, once they've decided what the objective is.
Players who enjoy "leveling up" and gaining power in the game world are likely to enjoy the opportunities for gaining social influence and wealth in a sandbox, although the notion of Saving The World on a big-deal quest can attract them (especially if there's a chance of keeping the Magical Thingy or looting the Dark Lord's treasury).
So: tailor the game structure to the genre and the players. The goal, after all, is for everyone to have fun. That is the only One True Way to do it: the fun way.