Jack had gone ashore, following his compass. Big mistake. Apparently, while he was away at sea trying to work out a blood debt he made with Davey Jones, he was a wanted man for the crime of piracy against the crown of Britian. He was spotted by a soilder and was therefore taken to prison, found guiltyafter his trial.
But where was the compass leading him too, you ask? Elizabeth Swann.
Before he was almost eaten by Davey Jone's "Terrible Beasty" (The Crakin), Elizabeth had told him he was a good man, and kissed him. But it was also her who had chained him to the boat before the giant squid devoured the Pearl completely. Still, Jack's compass wasn't broken, nor did it lie.
Jack sighed again. "She's probably already married to Will, now," he said. Jack had known quite a bit of women, but Elizabeth was the only one whom he really loved. But of course... that kiss was just to get him chained to a boat that was about to be taken down by a giant sea creature. Fortunately, Jack jumped past the Crakin, and threw his sword in it, making it think he ate him, and flew into the sea. He was picked up by a passing ship. The crew members weren't aware that he was Captain Jack Sparrow, so he told them he was John Spara who was a pirvateer, who's ship got wrecked during the storm.
I have to get out of here somehow! he thought. Jack noticed a pin that was just within his hand's reach. He had an idea...
