Two reasonable popular methods, which can also be combined:
You draw a map and place different adventure locations therein. Prepare random encounter tables. Have lots of rumours and other sources of knowledge available. Players can, by using the information, decide where to go and what to do.
Sandbox can be prepared all at once or a piece at a time. Some people even like buying a prepared one. There is lots of information on running a sandbox campaign available.
Non-player characters with agendas in a dynamic situation
Here, you prepare influential non-player characters - the queen, the dragon in the woods, the hobgoblin warlord, the high priestess - and decide what each is trying to accomplish and what resources they have. The queen wants to annex the hobgoblin lands, the dragons loves the priestess and lives between the kingdom and the hobgoblins, the priestess has seen a particular vision, etc.
The key is that all of them want the players characters to help them. Adventures are created when the player characters ally with someone or turn against someone.
For bonus points, have the player characters be some of the influential characters. This is easiest to accomplish if the campaign and the player characters are designed together, or if the characters are built with knowledge of the existing relationship map, or if the relationship map is built around the player characters.
Relevant key words for finding out more are "fish tank" and "relationship map".
Timelines (a comment by Matthieu M.)
You can also prepare a timeline for each NPC. Unless countered, the hobgoblin will have dug access to the artifact in 3 weeks, accidentally released the lich by opening the artifact in 1 week, been converted to undead, along with half its command in another week, etc... You can even identify some specific divergence points -- do they acquire this scroll they need, or not. Of course, players will wreck the plans, but you have time between sessions to adjust the goals/timelines in response to the players' actions.
All of these approaches give players plenty of freedom (the possibility to do so is what makes roleplaying a different medium from computer games and books etc.). A game mastered used to tight plots might ask: What if they need to save the world, but choose to do something else?
The solution is simple: If the future of the world is what is at stake and the players choose not to save it, or fail at their task, the world goes boom. That this is genuinely possible makes the quest a lot more interesting and engaging; there are actual stakes.
And there are plenty of post-apocalyptic games and game worlds available, in case you want to continue the game after the world ends.
The alternative is to not have so big stakes in play.