This issue specifically could be due to loosely connected axles slipping out of your drivetrain’s motors. Double-check that your axles are all the way in and then tighten your axle collars if necessary.
Overall, however, it’s most likely a coding issue affecting how the robot reacts to the outputs from its sensors. Here is a VEX Forum post with an example PID that you can compare yours to to help you troubleshoot it: VEXCode PID Tutorial