I had that in my buttocks, on the right side, (glute muscle) and it was very painful and stressful. My trainer (well, ex-trainer since I can’t train anymore) who is also my massage therapist gave me some stretching exercises to do for this specific muscle group and it took care of it.
In my case it was from not moving enough and/or bad posture.