It's usually a process of attrition. The first question to ask is what makes this question interesting? It was a question asked by a famous mathematician — Fermat who died in 1665 and all of whose outstanding question apart from this one were solved by the early 1800s; then in 1816 the French Academy established a prize to solve this one; by then it was recognised that established techniques weren't enough; and it is this that makes the problem interesting — what are these new techniques? this turned out to be the development of new number systems and their geometrisation.
Mathematicians learn the art of asking the possible, and the important; sometimes it's difficult to discern where the boundary lies; that again comes with time; Fermat's last theorem is an obvious generalisation of Pythagora's theorem (a much more immediately important theorem — it proved its importance in antiquity, and then in the development of vector and metric manifolds important to both special and general relativity). Fermat probably believed it to be a possible question — it turned out to be an important one.
Again through the process of time, the percolation and maturing of these new techniques it's just maybe possible that Fermat's Last Theorem will be an exercise set for university students, rather than being one that exercised the best mathematical minds of the last three centuries. After all it took Galileo to start measuring just hw long it took a pendulum to swing, whereas any schoolboy interested in physics and bothered enough to do the experiment can actually do this.
It's worth quoting a comment by Cartier on this:
These two problems, Fermat and Riemann, are in some sense rather futile: Fermat’s problem concerned a very particular equation, and the Riemann hypothesis can be interpreted in terms of very subtle regularities in the apparently random distribution of prime numbers. In itself, a counterexample to the Riemann hypothesis, given the present state of our knowledge, would have very small “practical” consequences and would certainly not be a catastrophe.
A note on the solution: Fermat's last theorem is solved by an appeal to the Modularity theorem, which is a special case of what is currently called the Langland's program, and which appears to be the correct higher and non-abelian generalisation of class field theory - which basically tells you how badly factorisation fails for these new number systems (rings). It's this context that appears to be its natural home.