First, I start with an overall concept.
From there, I determine what this means for the game world. Then, I try to write out an outline of the major plot points to lead up to the Grand Finale. Basically, I say "Where do I want the player to start?" and "Where do I want the player to end up?" Then, I make a first pass at figuring out a logical series of events which lead from start to finish.
Then, as I write the game, I see those quickly diverge, and revise constantly. Maybe when I draw out a map, I'm inspired to add a nifty tower. If I want one, I ask myself "Why is this tower there, in-universe?" Unless the entire game is taking place in someone's demented mind, there needs to be a good reason why, for example, a large tower or castle would be sitting where it is. Those are gigantic amounts of labor and expense to build, much moreso in the classic fantasy setting. But even today you wouldn't see someone just saying "Eh, I want to put a castle there."
Unless that person is an eccentric billionaire, that is.
Basically, I have an idea of where I want to go, then as I actually start making the game, drawing the maps, I let that idea shift and change significantly. In my current game, I'm finding huge amounts of change as I say "No, that won't work, I'll try this."