Stimming is usually harmless and often can serve as a pleasant outlet. Even though sometimes you might find yourself doing something before you realize it, you can usually stop it or prevent it if you really don't want to do it. There are lots of people who stim in private, preferring not to in public. If you're concerned you might hurt yourself, you'll probably be vigilant now and be able to catch yourself next time.
There are also all kinds of ways to stim that aren't obvious, like listening to certain sounds or making them, or playing with objects, fidgeting, etc. You might be stimming in ways that you don't even realize are stimming - I wouldn't worry too much about one incident, but now you know the kind of thing to look out for.