Not exactly true. The original proposal was as an ASW weapon, but that wasn't taken up.
Specifically, it was proposed as a concept in 1964-5 to kill Juliet and Echo class SSGNs who had to remain surfaced to guide SS-N-3 Shaddock, either against carrier groups (for the antiship version) or into land targets, instant sunshine delivery thereof. Hence the name - it was proposed as a means to attack "whales", meaning large surfaced submarines, at standoff range and interrupting their attack.
However, that was seen as too much of a niche role to justify development funding, and the project was loitering in limbo for a couple of years; then the INS Eilat was taken out by two Komar-class FPBs off Alexandria, and CNO made air-to-surface and surface-to-surface weapons a priority to counter the threat of ASCM-armed small combatants (particularly given the shrinking carrier force as the Essex-class began to retire)
Even then, it was a year before work started properly, the Request For Proposals wasn't issued until 1970, and despite having some private-venture work in hand McDonnell Douglas weren't selected as prime until 1971, with the scope expanded from being an air-launched anti-submarine weapon to include surface and submarine launch and anti-ship use being the priority (since by then the Charlie-class SSGNs were firing missiles while submerged, making the original Harpoon proposal redundant)
The snap approach had been the Interim Surface to Surface Missile, a modification of the AGM-78 Standard anti-radiation missile for surface launch (fitted to some Knox-class frigates and PGMs). Initial emphasis for a more capable solution had been on "Fireflash", a quick'n'dirty conversion of the BQM-34A Firebee target drone to act as an antiship missile; orders were placed in 1968 and a test fit on the destroyer Anderson proved the concept, but by 1971 Harpoon was seen as more versatile (being available by then in air, surface and submarine-launched versions) and Fireflash was terminated with Harpoon pursued instead.
I did say originally, hence the choice of name 'Hapoon' an allusion to spearing breaching whales.
All rather moot now, firing an SM2 or 6 (M3.5 and a lot of explosive and KE) at things is the current preferred option.