Photonic band gaps are created through the periodic variation of the refractive index in a photonic crystal. This periodicity causes constructive and destructive interference of the electromagnetic waves, leading to the formation of allowed and forbidden bands. The specific arrangement and materials used in the photonic crystal determine the position and width of the photonic band gap.