Yes, you might be guessing right, swelling and pain could be due to
muscle strain which on contracting suddenly could cause a tear or minor bleeding. You can apply local pain gel with gentle massage and hot foment with warm water. Take, over the counter pain medication and muscle relaxant for couple of days. Keep observing for swelling, redness and consult an orthopedic doctor if it persists to get checked up. Drink lot of water and take complete rest. Do update on your progress. Take care.