Borrowed from Catalan carall. Doublet of carajo. Cognate with Portuguese carai.
Practice speaking and memorizing "caray" and many other words and sentences in Spanish.