"highest point of something vertical, most elevated end or point," Old English top, toppa "summit; crest, tuft, bunch of hair," from Proto-Germanic *toppa- (source also of Old Norse toppr "tuft of hair," Old Frisian top "tuft," Old Dutch topp, Dutch top, Old High German zopf "end, tip, tuft of hair," German Zopf "tuft of hair").
There are no certain connections outside Germanic except a few Romanic words probably borrowed from Germanic (toupee (n.) is from one of them, Old French top "tuft, forelock;" also compare Spanish tope).
Indo-European languages seldom have a "top" word so generic; it may be used of almost any upper part or surface. German has Spitze for sharp peaks (mountains), oberfläche for the upper surface of flat things such as a table.
From mid-13c. as "head, crown of the head;" mid-15c. as "piece fitted to the top of something." Specifically as "beginning of a story, narrative, etc." (as in from the top), by late 14c. Also by late 14c. specifically as "head or upper part of a plant," especially the above-ground part of root-crop plants such as turnips or carrots. By early 15c. as "cover or lid of a vessel."
The meaning "highest position" is from 1620s; the meaning "highest example, type, or representation, best or choicest part" is attested from 1660s, as in the Hibernicism top of the morning (attested by 1843). Also by 1620s as "upper part of a riding boot." The sense of "dominant sexual partner" is by 1961.
Top of the world as "position of greatest eminence" is from 1670s. Top-of-the-line (adj.) is by 1950. Figurative expression off the top of (one's) head "impromptu, without consideration" is by 1939.
Top in the nautical sense of "platform surrounding the head of a mast" is by early 15c. and is an element in many sailing words as well as nautical figures such as top and topgallant "in full rig, in full force."