Probably dirt or lint.
Option 1. Turn off the BB. Press and hold the trackball and rotate first in the direction that it doesn't work, then slowly roll it around in all directions for about a minute. Turn it back on and see it it works. If so, get a case and don't carry it in your pocket.
Option 2. Take it apart.
How to clean your BlackBerryxxx8217;s Trackball « BlackBerryInsight - Get into the BlackBerry World!