Someone asks how to do X when they really want to do Y. They ask how to do X because they believe it is the best way to accomplish Y.It's a pattern of miscommunication where questioner seeks premature closure with wrong assumptions. It's quite hard to convince questioner to accept any other solution than he originally considered the best. Usually the questioner have I-Know-It-All attitude, they just need help for doing their X.
XY problem can even be extended to XYZ problem
There may be a solution Z that is even better than Y, but nobody can suggest it if Y is never mentioned.This is quite common time-wasting problem especially on customer support and help-desk work, but there have been documented cases even on project work.
It would be great that everybody would take time to learn How To Ask Questions The Smart Way by Eric Steven Raymond :
"
Describe the goal, not the step"
If you are trying to find out how to do something (as opposed to reporting a bug), begin by describing the goal. Only then describe the particular step towards it that you are blocked on.
Often, people who need technical help have a high-level goal in mind and get stuck on what they think is one particular path towards the goal. They come for help with the step, but don't realize that the path is wrong. It can take substantial effort to get past this.
Stupid: How do I get the color-picker on the FooDraw program to take a hexadecimal RGB value?
Smart: I'm trying to replace the color table on an image with values of my choosing. Right now the only way I can see to do this is by editing each table slot, but I can't get FooDraw's color picker to take a hexadecimal RGB value.
The second version of the question is smart. It allows an answer that suggests a tool better suited to the task.
But it could be inconvenient to RTFM the customers. If the question sounds strange one can apply simplified root cause analysis methods. Specially 5 Whys works quite well. You just keep asking "Why?" until the questioner actual tells the Y he wants to accomplish. It may sound childish and silly, but in the end save you both time.
Asking the right questions is much harder than giving correct answers