Agile strategy?

The question that I’ve always had about agile methods is: where does the project come from? Based on my limited knowledge (and I’m like a like a pagan at a theology convention here), the agile movement assumes a defined project or problem at the outset and then figures out where people should sit: by themselves, with a friend, or with a group. This is all fine to me; you take your Mountain Dew and sit wherever you want. But where is the problem coming from? Are you working on the right problem? How do you know?

I understand user stories and all that, but at that point you’ve already dedicated a team to working on the problem and so they go and — gasp! — actually talk to users. But how did they get tasked with that problem, the redesign of the inventory reorder system say, rather than some other problem, updating the contractor billing system, say? Do agile methods go upstream?