The two elements are mens rea (guilty mind) and actus reus (guilty act).
If you lack mens rea (only the absence of one of the two is needed to acquit) then that falls under insane automatism. Examples include crimes committed under delusional disorders, psychosis, or heavy involuntary intoxication. If you lack actus reus, less common, that is automatism. Examples include crimes committed while sleepwalking, experiencing a medical episode, or having a bodily reflex like sneezing.