If someone is "spinning a yarn" it means they are lying or stretching the truth.
On board ship there would have been miles of rope, which needed regular maintenance and repair. Spun yarn was the basic material on board. Often, a group of sailors got together for the task, swapping old sea stories as they worked and the tales were usually embellished in the telling.