Why do turtles ride on alligators?
turtles will crawl onto anything to get out of the water and bask, fallen logs are common and they likely cannot tell the difference between a still alligator and a log.  It might also be possible that the turtles do know what the gator is and are hoping to tag along and pick up scraps after it strikes. 

I image that for the gators thrashing around to dislodge the turtle has to high a risk of scaring off prey so they just put up with it.