Literally meant the lookout basket in the top mast of a Spanish galeon ship. Sailors would get very sea sick when assigned to this post, so when they would think of becoming mutinous, the captain would send them up to the carajo as punishment. Hence the Spanish interjection meaning anything from get out of here, go fly a kite, go fuck yourself, etc...
Vete para el carajo.
No me importa un carajo, I don't care a shit!
It is unfortunate that most people do not search for original sources. All you have to do is check with the final authority on the Spanish Language, the Royal Academy and you will get this word as originally meaning the male reproductive member or penis. It may have been later applied by sailors to describe the top mast lookout point in reference to an undesirable place to be in or thing to have but more than likely initiating with the negative connotation which applies when referring to said member in undesirable situations.
In most Spanish speaking countries the original connotation has been lost and that of "Go to hell is" the most appropriate translation for "vete para el carajo"