He was captive, but wasn't really aware of it for a great deal of the time. First, he was seduced by Calypso on the island (though he didn't completely give in to his baser instincts like most of his crew did....the pigs...ha). He stayed on the island for 7 years because it took him that long to realize what Calypso had done to him and his crew (and to care about it enough to resist and make a smooth exit).