If the film wound back into the cassette then either you did it by mistake, or the camera did it due to some sort of fault if it's one with an automatic wind/rewind system? If there was no film cassette inside at all when you opened the back then either someone is playing tricks on you, or you forgot to load the film.
If you let us know what happened, and tell us the make and model of camera, then I'm sure someone on here can explain what's happened and give you some suggestions on how to stop it happening again.
Film photography can be good fun once you get the hang of things, so don't give up yet! Most of us older ones on here were lucky as we had a friend or relative to show us how to load a film into a camera when we were starting out. Having said that, even with years of experience shooting film, we can still get it wrong occasionally!