Yes, you are right that the muscles in the back part of your thigh are called the hamstrings. And yes, they can be pulled or strained. A pulled muscle occurs when too much tension is placed on the muscle, leading to swelling and pain. This frequently occurs in the hamstring, most often in the setting of vigorous exercise such as running or weight lifting.
Fortunately, most of the time a pulled hamstring is an injury
that will heal on its own without any specific medical treatment. Most cases can be treated with rest, icing of the painful area, and anti inflammatory medications as directed by your doctor
. It is especially important to not engage in vigorous physical activity until the pain is completely gone, so as to speed healing and avoid the potential for a second, more serious, injury.
I would recommend that you see your primary care doctor
about this injury. They can examine your leg for pain and swelling and confirm that this is just a pulled muscle and that there is no more serious injury such as a sprain in a joint. Based on what they find, they can also give you some sense of how long it will be before you can get back to exercise.