Well, if I was doing D&D? I'd have a setting bible with lots of stuff. I'd do the prep work.
Now though? Yeah, I'd likely lean into something like Ironsworn (although, to be fair, that's a fairly narrow genre and not as broad as D&D - I'd have to hunt for another game if I wanted something as encompassing as D&D) where you'd start with a village. Player makes a Move - Gathering Information, for example. On a strong success, I'd make something up that leads them on an adventure. If I had no idea, I'd turn to the rest of the players and ask for options. Or, possibly, Ironsworn does come with an Ask the Oracle mechanic that allows for some random inspiration.
The simplest Ask the Oracle is Yes/No questions. So, in one episode where we did pretty much exactly this, I framed the question - "Is this a supernatural event?" (No) "Is there a mystery?" (Yes). "Is it a murder mystery?" (No) "Missing person?" (Yes)
Ah, ok, I've got enough to work with now. It's just starting out so there is a missing child that needs rescuing. I'm not going to worry too much about the mystery yet, because there's time for that as they progress.
In Ironsworn, when you undertake a quest, you swear an Iron Vow (resolving those vows is how you gain XP to advance your character). So, the players swear - which can fail btw, resulting in more complications. Play progresses from there.
Note, the players could make multiple Gather Knowledge checks and spawn multiple events. As the players progress through a vow, checks can also spawn more complications. So on and so forth.
By the end of the scenario, we could discover (and I'm making this up, this is hypothetical) that the missing child is the illegitimate child of the leader of the town and was taken into the woods Hansel and Gretal style to be eaten by a witch. At the outset of the task, literally no one at the table knows anything. It is all revealed during play.
Basically, an entire couple of sessions of play could easily be generated by a couple of die rolls and some leading questions. Totally sandbox, total player freedom.