In more linguisticky terms, you might say that velar stops before /æ/ are sometimes palatalized in loans from English. Why?
We can find our answer in Adaptation and Transmission in Japanese Loanword Phonology, Clifford James Crawford's doctoral dissertation, in section 2.3.3 "Palatalization of velars before /æ/". Quoted below:
[T]here is an allophonic variation in English between velars with a relatively
front place of articulation, as in key, that occur before front vowels, and velars with a relatively back place of articulation, as in coo (Keating & Lahiri 1993). Fronted velars are thus likely to be perceived as palatalized by Japanese listeners, given their similarity in articulation (Akamatsu 1997).12 (emphasis added)
So when these words were borrowed, it's likely that native speakers of Japanese did perceive a resemblance to the original, even though you, as a native speaker of English, do not.
Why does this occur only before /æ/? Crawford continues:
[O]nly velars before /æ/ actually can be palatalized; the other possible source sequences here (/ki, kɪ, ke, kɛ/) are always adapted with a (phonologically) plain velar instead. This is because Japanese phonology does not make a palatalization contrast before front vowels (Ito & Mester 1995).13
Crawford also attempts to address the question of why palatalization occurs only some of the time. He shows relationships between the date of borrowing and likelihood, and he also shows that words with "similar enough" cognates in other languages available for borrowing tend not to exhibit palatalization. These two factors combined, he says, give us a relatively strong way to predict whether velar stops before /æ/ will end up palatalized in Japanese. For details, please see his dissertation, linked above.