The word ox comes from the Old English oxa. In Old English, as in Indo-European languages in general (historically and even today), the number of a noun (singular or plural) and its function in a sentence—whether it was the subject, direct object, indirect object, or had some other relation to a verb or another noun—was largely (not solely) governed by sets of endings tacked onto it, or changes made to the vowels in it. These sets of endings or changes were called declensions, and each type of relationship associated with an ending is called a case.
There were a number of declensions in Old English; the two most prominent were the weak declension, containing the weak nouns, and the strong declension, containing the strong nouns. Old English oxa was a weak noun. The forms that we have of its descendant today are derived from the nominative case endings; these are the forms that would indicate that a noun is the subject of a sentence, or the forms that would be used when writing a list of nouns.
Since oxa was a weak noun, its plural form (the nominative plural form) was oxan. Over the course of centuries, the a "weakened" to an e, giving us oxen.
Fox, on the other hand, comes from the Old English fox, which was a strong noun; its Old English plural was foxas, whence we get foxes.
The source I used to confirm the declension of fox has an entry for the Old English box; however, it has no declension information. Using this translator, however, it appears that the nominative plural was boxas, giving us boxes.
Although Modern English has largely dropped the declensional suffixes we got from Old English, we occasionally see them peeking through, as we do here.