The modern word ant comes from Old English æmette. With the standard Germanic stress on the first syllable, if you say æmette often enough and fast enough (try it!), you'll stop bothering with the e's, and end up with something like æmt. Once there, it's a short jump to ant, by a process called assimilation: the bilabial m (pronounced with the lips) is assimilated by the dental t. If you make an m dental, you have an n. This is a common linguistic occurance: hemp, from OE henep; as well as all those words with Latin prefixes like in + logical = illogical, and actually, ad + similis > assimilate.
This process also happend to a word that many (I suppose most) Americans pronounce the same as ant: aunt.
Aunt comes from Middle English aunte, from Anglo-Norman, ultimately from Latin amita. Here again, once the middle syllable is dropped, the t plays Borg to the m's futile resistance. So you have something like anta/ante. Except there's a u. Why is there a u? Well, it seems to have originated with Anglo-Norman. There are many au-words in Anglo-Norman whose Parisian French (and often modern English) versions lack the u. For example:
aume (= English soul), beside French ame from Latin anima
aumuce (amice), from Old French amis, from L amictus
aunsien (former, ancient), beside F ancien
auprés (after), beside F aprés
ausmes (> E alms)
ausuager (> E assuage)
Now, of these, only aunt retained its au-spelling. Why? I'm not sure; I could speculate that later contact with French kept words like amice and ancient closer to their Parisian spellings than the Anglo-Norman ones, but it could just as easily be due to a change of spelling conventions internal to English. Perhaps one of my knowledgeable readers could fill in this gap?
Either way, it's fun to watch the process work on words from such different sources.