Like many of the other malas palabras in Spanish, carajo can be translated several ways in English. Everything depends on context.
If you say:
Then it translates to something along the lines of "what the fuck"?
You probably noticed I said "along the lines of", and were hoping for a definition a little more concrete. Essentially you can translate carajo as either damn, hell, shit or fuck.
The are two reasons you can't make a direct translation of carajo in English. Reason #1 is context. But that's fairly easy to clear up after you've seen how the word is used in a variety of situations.
Now it's time for reason #2, and this is where the difficulty in translation lies. Carajo doesn't have the same meaning in all Spanish speaking countries. In some places carajo is as strong as the word fuck, in others it's a milder expression.
With that in mind, ¿Qué carajo? could also be translated as "what the hell?". You've got to know your audience. And for any Spanish speakers out there trying to learn a bit of English, "hell" is a not very strong at all, so if you're looking for a mild version of "Qué carajo", you'll want to you use "what the hell". "what the fuck" is extremely strong/vulgar, so it's something you'll only want to use with your friends.
At any rate, be sure to keep that bit of consejos (advice) in mind. Now let's look at some more ways we can use this word.
¡Vete al carajo!
Go to hell
When you stub your toe, feel free to let off a little steam by shouting out...
In the context of exclamations of surprise, etc, you can use it in the same way you would the word "damn", or "shit", although Spanish has another word for shit -- mierda.
Me importa un carajo
I don't give a damn/fuck
¿Qué carajo quieres?
What the hell/fuck do you want?
En que carajo estabas pensando cuando hiciste eso
What the hell were you thinking when you did that!
¡Carajo! Se me olvido por completo recoger a mi esposa
Damn, I completely forgot to pick up my wife.
Here's one more for good measure...
No entiendo ni un carajo
I don't understand a damn word
That's it for today, ¡espero que te sirva!