Q From Mike Daplyn: Swain nowadays seems to occur only as an invariably jocular synonym for suitor (itself almost always jocular), and in the two nautical compounds boatswain and coxswain. Am I right in thinking it was once a more general term for a male person, and when did it fall out of use as such?
A It has never been a general term for a male person. It came into English from Old Norse sveinn, a lad, but began its life in medieval England in reference specifically to a young man attending a knight, hence a fairly lowly servant. Later, still in medieval times, it broadened to take in any male servant or attendant.
By the end of the sixteenth century it seems to have shifted into the countryside, because it came to mean a farm labourer, shepherd, or similar male worker. Because of these associations with rustic simplicity, poets borrowed it for a country gallant or lover, a sweetheart or wooer of a fair maid. These days, as you say, it only appears in poetic contexts or humorously.
The two nautical terms are specific applications of the idea of a male servant charged with some duty or responsibility. The first is obviously from boat; the second derives from cock or cockboat, a ship’s boat, a word which came into English from Old French coque, itself based on a Latin word meaning a block of wood.