"large, triangular foresail of a ship," 1660s, gibb, of uncertain origin. Perhaps related to gibbet on the notion of a sail "hanging" from a masthead [Barnhart, OED]; and compare gib "projecting arm of a crane." Or perhaps from the nautical verb jib, jibe "shift a sail or boom to the other side" (1690s), from Dutch gijben, gijpen "turn suddenly" (of sails), which is apparently related to gijk "boom or spar of a sailing ship."
An observant sailor watching a strange vessel approach at sea judges her character by the condition of the jibs; hence cut of (one's) jib "personal appearance" (1821). Related: Jib-boom (1748). The jib in jib-door "door flush with a wall" (1792) is of uncertain origin and probably is not the same word.