early 14c. (mid-13c. in Anglo-Latin), "one appointed by another to act in his place," from Old French atorné "(one) appointed," past participle of aturner "to decree, assign, appoint," from atorner "to assign," literally "to turn to" (see attorn). The sense is of "one appointed to represent another's interests."
In English law, a private attorney (attorney in fact) 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]
In U.S., barrister is not used and the general designation became properly attorney and counselor at law; when presenting a case in court, simply counselor. The double -t- is a mistaken 15c. attempt to restore a non-existent Latin original, perhaps by influence of legal Latin form attornare.