You probably have "Predictive Focus Tracking" or "Dynamic Area Autofocus" or "3D Tracking Autofocus" enabled, all of which allow the camera to focus where it wants to instead of where you want it to. I'm not that familiar with the D5100, but from what I can tell in the owner's manual all three of those are automatically enabled any time the autofocus mode is set to AF-C and they are disabled any time the mode is set to AF-S. My D7000 has menu options to disable them but I didn't see anything to disable them on the D5100. They were the first thing I disabled when I bought that camera because I absolutely DETEST those settings. I do NOT want my camera deciding what to focus on, I'll tell it what I want it to focus on.
Perhaps someone who is more familiar with that camera can provide more information.