google
ref
Middle English: from ah + ha1.
wiktionary
ref
etymonline
ref
aha (interj.)
expression of surprise or delighted discovery, late 14c., from ah + ha.
This seely widewe and hire doughtres two ... cryden out "harrow!" and "weloway! A ha! þe fox!" and after him they ran [Chaucer]