Geological dynamic hazards during coal mining can be caused by the failure of a composite system consisting of roof rock and coal layers, subject to different loading rates due to different advancing velocities in the working face. In this paper, the uniaxial compression test simulations on the composite rock-coal layers were performed using $PFC^{2D}$ software and especially the effects of loading rate on the stress-strain behavior, strength characteristics and crack nucleation, propagation and coalescence in a composite layer were analyzed. In addition, considering the composite layer, the mechanisms for the advanced bore decompression in coal to prevent the geological dynamic hazards at a rapid advancing velocity of working face were explored. The uniaxial compressive strength and peak strain are found to increase with the increase of loading rate. After post-peak point, the stress-strain curve shows a steep stepped drop at a low loading rate, while the stress-strain curve exhibits a slowly progressive decrease at a high loading rate. The cracking mainly occurs within coal, and no apparent cracking is observed for rock. While at a high loading rate, the rock near the bedding plane is damaged by rapid crack propagation in coal. The cracking pattern is not a single shear zone, but exhibits as two simultaneously propagating shear zones in a "X" shape. Following this, the coal breaks into many pieces and the fragment size and number increase with loading rate. Whereas a low loading rate promotes the development of tensile crack, the failure pattern shows a V-shaped hybrid shear and tensile failure. The shear failure becomes dominant with an increasing loading rate. Meanwhile, with the increase of loading rate, the width of the main shear failure zone increases. Moreover, the advanced bore decompression changes the physical property and energy accumulation conditions of the composite layer, which increases the strain energy dissipation, and the occurrence possibility of geological dynamic hazards is reduced at a rapid advancing velocity of working face.