Hi, thank you for contacting JustAnswer.com. My name is Russell. I will do my best to provide the right answer to your question.
That sort of problem often happens owing to the autopilot tiller control wanting to correct the course, and (with the autocompass not properly connected, or with a problem with the connector or the cable to the autocompass) there is no response sensed so the autopilot goes hard over, trying to get a response confirming that the turn/correction has been made.
Corrosion may have gotten into the connection from the autocompass to the autopilot. To treat that, check the cable from autocompass to autopilot first, along it entire length, for cuts, severe bends, etc.
Then disconnect any connector on the line from the autocompass to the autopilot, scrub both sides of the connector for 20+ seconds with a clean dry brush, then wipe down both sides until the metal shines, with a clean dry rag cloth. Then connect again firmly.
And try the autopilot again.
Another possibility is, that the autocompass is jammed, so make sure it isn't.