Jack has two drives:
- Being captain of a ship
It has been shown time and again how Jack will go to extraordinary lengths to become captain of a ship, even if it's just a rowboat (as seen at the end of At World's End). When the Kraken was attacking The Black Pearl, Jack's first instinct was the same as anyone else's would be in such a position - run. But when he got far enough away from the ship to see the Kraken breaking up his ship, he realized that as captain he should be with his ship and his crew.
The only reason he stayed on the boat after trying to help everyone else get off is because Elizabeth had tied him up. But you'll also notice that even once he gets free, he accepts his fate and actually tries to attack the Kraken before being swallowed. Jack stayed true to his principle - the captain goes down with his ship.