How do opiates cause anterograde amnesia?
This is a tricky thing to answer, but I'll do my best.
I can't find any sources for this, yet from my fairly in-depth knowledge of recreational drugs. Opioids (or opiates) don't by themselves give anterograde amnesia. At high enough doses you can "nod" off to a point where you can forget recent memories without losing touch with long-term memories. Yet when you completely "nod" off, you are unconscious rather than conscious and not forming new memories.
To my knowledge this hasn't been studied enough to warrant a straight answer. It's a bit confusing. As you can reach a point of "nodding" off where you aren't unconscious, yet somewhere in the middle ground.
So to answer your question as best as I can is. It hasn't been studied enough to give you a full answer. There are no studies/papers written on the subject. If this was "How do Benzodiazepines/Alcohol cause anterograde amnesia" it would be a much simpler answer that has sources behind it.
This sadly doesn't answer your question. Yet from my hour or so of looking I can't find any study that makes a connection between the two. Except the complete opposite of what you're asking where Naloxone was used in the prevention of Electroconvulsive shock (ECS) induced anterograde amnesia. Source for the above.
Apologies, yet if you would like to update me on what your professor/teacher/etc. wanted as an answer to this, I would be very appreciative.
Unless it was from a theoretical stand point. Where I guess you could wager that from the use of other CNS depressants cause it. (Namely Benzodiazepines, Barbiturates, Alcohol, GHB, and GBL) Then that would make sense. Yet after 90 minutes of digging through pubchem and a few other journal websites, came up with nothing but the exact opposite of what you asked.