"Attorney generals" is a noun phrase (admittedly of questionable adjectivity).
"Attorneys general" is a blind idiot translation of a phrase in a language with different grammatical rules (Latin, IIRC).
"Attorney" is a noun. "General" as used here is an adjective.
It's unusual in that the adjective follows the noun without a hyphen, but it's common enough, and it's where prepositional phrases are seen, like "Big man on campus" and "powers that be".