The hamstring comprise of 3 muscles located on the posterior aspect of your thigh.
Hamstring injuries usually occur during forceful deceleration, when the hamstring muscles are contracting forcefully while lengthening (eccentric contraction).
An example is during the late swing phase of sprinting, when the muscle works to decelerate the hip and knee as they prepare to take the next step.
Here are some exercise you can try to gradually load the injured muscles to help with recovery.