Welcome to the site Michelle
Up until a few weeks ago, I had a beautiful and 11 inch red Oscar, unfortunately she died. Anyway, I recall her doing exactly what you describe yours doing a few years ago (nothing to do with her demise, before you worry) it was almost as if she was having some kind of fit. Anyway, like I said this was probably three years ago and she lived for a long time after.. why they do it is a mystery. They could have something stuck in their mouth which they are trying to dislodge I suppose. Maybe even some irritation somewhere on the body makes them do it.
You sound like you keep your tank in good condition, if the water is good, there is no reason for fish to be ill. Unfortunately, they do develop illnesses sometimes that have got nothing to do with anything you've done.