Shortened by people, who do not want to, or at the moment too annoyed to, pronounce the whole phrase "what the fuck".
Shortened also because it can be typed faster and/or to avoid explicitly typing the word "fuck".
Usage same as the words fuck, the fuck and what the fuck
Said by a little boy who was expecting a pony but has received a dog as his birthday gift:
"I asked for a pony; dafaq is this ?"