It has to do with voice onset timing (VOT):
In phonetics, voice onset time, ... , is a feature of the production of stop consonants. It is defined as the length of time that passes between when a stop consonant is released and when voicing, the vibration of the vocal folds, begins .The vocal folds in anticipation of a vowel, say the vowel in skate for example, start to vibrate early, resulting in the preceding voiceless stop /k/ sounding like [g]; but, it's not [g] at all. It's a de-aspirated /k/. In other words, the puff of air, called aspiration, that usually releases with /k/ (e.g., king) is not fully released. The result is a de-aspirated /k/, a sound similar to [g], but not [g].
Hope that helps.
Student or Learner