These kinds of things can happen in many ways, like playing volleyball,
tennis, carrying your backpack at school, getting groceries out of the car, sleeping in a bad position, walking the dog and he jerked on the leash, etc.
Find some different ways to stretch the particular area of your shoulder that is bothering you. Try putting your right hand on the back of your neck, then grab your right elbow with your left hand and slowly pull your elbow to the left.