If you have just started working out or playing a sport you haven't played in a while it's important to realize that it takes time for your muscles to have the same flexibility that they may have had and that you remember having. This occurred to me when I played soccer for the first time in a few years and I ended up pulling a groin muscle. I knew how to make the moves but because I hadn't stretched properly my body wasn't able to do what I wanted it to do. I stopped quickly and cut back to the side and that is when it happened. Luckily it wasn't a bad pull but it still made it uncomfortable running for a few weeks.
Also, prior to beginning a workout you need to warm up your muscles with a few minutes of jogging or light running so that you warm your body up in preparation of the real workout.
Below is a really good video I found on how to stretch before working out.
Remember to stretch properly before and after workouts in order prevent injuries and to increase performance and athletic abilities.