The story
From Italian (southern dialectal pronunciation of) acido (“acid, heartburn”). The non-medical sense, upset of the mind rather than the stomach, developed under the influence of agitation. Doublet of acid.
Etymology from Wiktionary, CC BY-SA 4.0.