Ahoy is a shout used at sea to hail another vessel. Ahoy there, ship ahoy, land ahoy.
The pattern is the thing sighted followed by ahoy: land ahoy, sail ahoy. It is genuinely used in sailing and is otherwise almost entirely comic now. Alexander Graham Bell wanted ahoy to be the standard telephone greeting, and Edison's hello won instead — which is one of the closer near-misses in the history of English. Note ahoy-hoy, which survives as a joke about exactly that.
1phraseahoyA shout used at sea to hail another vessel.
“"Ahoy there!" shouted the captain to the fishing boat drifting nearby.”
ahoy is a hailing shout.
Middle English hoy was a call used to drive cattle, and a- was added as a hailing prefix. The word is a shout that became a word rather than the other way round.
Middle English
hoy
English, today
ahoy
From a- + hoy, from Middle English hoy, a greeting dating back to the fourteenth century. Compare Dutch hoi (“hi!, hello!”).
Etymology from Wiktionary, CC BY-SA
Practised in Sea & Sailing