A castaway is someone who's stranded on shore, often after surviving a shipwreck. A sailor who swims to a small island after a terrible storm can call herself a castaway.
A castaway is more likely to be a character in a book than a real person, although occasionally a survivor has found him or herself washed up on an island. Some theories about what happened to the pilot Amelia Earhart after her disappearance include the idea that she was a castaway on some Pacific island. In the 15th century, a castaway was "one who is rejected." The deserted island survivor meaning came along in the late 1700s.