Flight plan ignored

Similar behaviour has been reported (FS2020):
What am I doing wrong? AP randomly goes off course
172 Autopilot Nav mode not working
Funny thing it happened to me today with the cessna-172-skyhawk-g1000 . I went away from my pc for about 20 minutes and once back I noticed the autopilot was still on (GPS mode) but the aircraft for some reason stopped following the Magenta line, deviating to the right. I’ll try to replicate.