There are a couple of reasons why a phone would factory reset itself. One is that you did it, which you've already said you didn't. The second is that something went wrong with a system update, or the system became corrupted. If that's the case then your phone is bound to remain unstable and could very well continue to randomly reset itself. The third is that a remote wipe command was sent to it via your Google account. Does anyone else know your password, or is it easy to guess? You might want to log into your Google account history and see if there's any logins you don't recognize.