The story
From Anglo-Norman and Law French, (modern French avocat général or procureur général), hence the unusual order of adjective following noun, instead of idiomatic English *general attorney. Compare court martial, notary public, secretary general, surgeon general.
Etymology from Wiktionary, CC BY-SA 4.0.