Leggatt and the captain are not so much related as they are symbolic representations of each other. According to Lionel Trilling:
the two young men are virtually the same person.
In literary terms, Leggatt is the captain's doppelganger, or his ghostly twin. In Freudian psychology, Leggatt is the "Id" (the emotional, secret desires) to the captain's "Ego" (the logical side which mediates the emotional). Remember, when the captain first sees Leggatt? He says:
He was complete but for the head. A headless corpse!
Leggatt is the headless version of the captain. The head is the logical; the body is the emotional. So, Leggatt is the side of the captain which he hides from the crew, his secret desires and fears.
The word "double" is used 19 times in the novella. Obviously, Leggatt is a mirror-image doppelganger who confesses that which the captain has wished to keep secret. The captain harbors the fugitive and dresses him like himself:
In a moment he had concealed his damp body in a sleeping suit of the same gray-stripe pattern as the one I was wearing and followed me like my double on the poop. Together we moved right aft, barefooted, silent.
Later, he connotes the dark side of his double:
And I knew well enough also that my double there was no homicidal ruffian. I did not think of asking him for details, and he told me the story roughly in brusque, disconnected sentences. I needed no more. I saw it all going on as though I were myself inside that other sleeping suit.
The Captain's ("Ego's") goal then is too conceal his Leggatt ("Id") from Captain Archibald, the "Superego," or moral construct that projects social values.