An aloof person is, by origin, a ship steering away from the rocks.
The word is built from the prefix a-, "on," and loof, an older form of the sailing word luff. Merriam-Webster defines the luff sense as sailing a ship nearer the wind. On a ship, aloof meant "to windward," toward the side the wind comes from.
The phrase has a close Dutch match. The linguist Anatoly Liberman, following the 19th-century etymologist Walter Skeat, traces aloof to on loof, corresponding to Dutch te loef, "to windward." Dutch loef houden means "to keep to the windward."
Why would a sailor want that? Merriam-Webster explains that sailing into the wind kept a ship clear of the shore or some other hazard. Liberman explains English "keep aloof" as "keep away," originally from a leeward shore or rock. Lee means shelter, and Merriam-Webster gives alee as the opposite of aloof.
Merriam-Webster's first known use of the adverb is 1523. The nautical phrasing lasted well into the 18th century. Alexander Pope's translation of Homer's Odyssey has the line "With all our force we kept aloof to sea."
The figurative sense grew out of that keeping away. Physical distance became emotional distance, and then indifference. Merriam-Webster dates the adjective, describing a person who holds back, to 1608. Today few people hear any sails in the word, but the old picture still fits: someone standing off from a hazard, watching it from a safe distance.
The deeper origin of luff itself is less clear. Skeat linked Middle English lof to a contrivance for steering, perhaps a paddle. Liberman finds that convincing and even floats a connection with glove, through the likeness of a paddle to the palm of a hand. He adds that this last step "is bound to remain guesswork."