If an automatic transmission vehicle is in P gear while driving, the gearbox may be damaged, but the probability is not high. In most cases, the gears will only be knocked out and cause abnormal wear. The P gear structure of the automatic transmission belongs to [Neutral+]. In the neutral state, a set of ratchet and pawl engagement structures are designed to assist vehicle braking when the handbrake fails to ensure that the vehicle does not roll away.
The picture above is the P gear locking mechanism of the automatic transmission. The finger on the picture is the locking pawl. It can move up and down. Under normal circumstances, it is lifted. When the P gear is mounted, the rear gear lever is driven by a mechanical device. A cam presses it down so that the pawl locks the transmission output and the wheel cannot move. It should be noted that there is an elastic buffer device between the cam and the gear lever, which means that the pawl will not necessarily move after the P gear is engaged. For example, in the picture above, the pawl is not aligned with the groove at this time, so it will not move. It moves, but the elastic device will keep pushing it. When the vehicle moves and the ratchet wheel rotates so that the pawl just aligns with the groove, the pawl will fall down and lock the ratchet wheel.