The Captain named in the poem is U.S. President Abraham Lincoln. The poem was written in memoriam of Lincoln.

There are theories that Lincoln was homosexual (the Log Cabin Republicans get their name from this), and Whitman was most definitely gay, which led to the theory that this poem is actually a love song of sorts.

I hold NO opinion on either theory, I just know they exist.