Since this has never happened to me in 20 years of Logic use, I'm going out on a limb and suggest that something in your system is sending some kind of midi controller data that is turning the thing on or off (well, that or maybe a key command getting triggered by mistake).
Try this: open your transport options by right clicking on the transport to open them, then check the autopunch so you can at least see if it's on, and maybe come to some kind of idea WHY it's turning on.
You could also go into your key commands (under the main Logic Preferences menu) and disable any key commands related to the auto punch so you don't accidentally trigger one.
Sorry, but I have to think this is a user error ;-)
i will try that. but i dont recall play and rec being set as autopunch key commands. or space and r. but you never know. it mostly happens when im recording midi. so maybe my keyboard is sending something out.