early 14c. (mid-13c. in Anglo-Latin), from Old French atorné "(one) appointed," past participle of aturner "to decree, assign, appoint," from atorner (see attorn). The legal Latin form attornare influenced the spelling in Anglo-French. The sense is of "one appointed to represent another's interests."
In English law, a private attorney was one appointed to act for another in business or legal affairs (usually for pay); an attorney at law or public attorney was a qualified legal agent in the courts of Common Law who prepared the cases for a barrister, who pleaded them (the equivalent of a solicitor in Chancery). So much a term of contempt in England that it was abolished by the Judicature Act of 1873 and merged with solicitor.
Johnson observed that "he did not care to speak ill of any man behind his back, but he believed the gentleman was an attorney." [Boswell]The double -t- is a mistaken 15c. attempt to restore a non-existent Latin original. Attorney general first recorded 1530s in sense of "legal officer of the state" (late 13c. in Anglo-French), from French, hence the odd plural (subject first, adjective second).