Could be a number of things but we need more information. What focus mode are you using? Are you in One Shot or Servo AF? What are you trying to focus on? How far away is it? If you are close, is the switch on the side of the lens set to limit focus distance in any way? When you're at 500mm is it trying to focus but not finding it or not focusing at all?
Jake brings up good points.
One big thing that changes when you zoom in to 500mm, is that your minimum focus distance increases, so if you're trying to focus on an object that's too close, you might be able to achieve focus at 200mm, but not 500mm.
If this problem exists when you're trying to focus on infinity, a distant object, then it's likely that your lens is faulty.
Jake brings up good points.
One big thing that changes when you zoom in to 500mm, is that your minimum focus distance increases, so if you're trying to focus on an object that's too close, you might be able to achieve focus at 200mm, but not 500mm.
If this problem exists when you're trying to focus on infinity, a distant object, then it's likely that your lens is faulty.
Although this does not directly address your question it is worth remembering. On the odd occasion when I thought the lens was not auto focussing and freezing I had accidently moved the AF point by touching the back screen with my nose or a finger. The lens was acuually focussing but way to the side if my subject where I was not looking.