Keratogenesis primarily occurs in the epidermis, the outermost layer of the skin. The process begins in the basal layer of the epidermis and progresses upwards through the different layers: stratum spinosum, stratum granulosum, and finally the stratum corneum where mature keratinized cells are shed off.