If you've completely forgotten something, and it's a systemic problem rather than just a momentary issue, then you are (or were) experiencing amnesia:
[Merriam-Webster]
1 : loss of memory due usually to brain injury, shock, fatigue, repression, or illness
2 : a gap in one's memory
3 : the selective overlooking or ignoring of events or acts that are not favorable or useful to one's purpose or position
If shock or fatigue are related, I suppose it could be appropriately used to describe momentary or episodic periods of forgetfulness.
But, generally, this is a term used only after a medical diagnosis, in a similar way to describing somebody as having anomic aphasia, Alzheimer's Disease or dementia. In which case, they could be said to be having "an episode."
For the routine inability to remember things, I don't think there's a more appropriate single word than just forget (or a variation) itself.
But there are several phrases that could be used to describe the situation:
- I was having a lack of recall.
- It's on the tip of my tongue.
- It completely slipped my mind.
- I had a momentary lapse of reason.
- I had a brain fart.
- I know it, I just can't remember it.
- I'm drawing a blank.
- I'm having a senior moment.
A word that can be used to describe a state in which you do something but, later, cannot recall doing it is fugue:
[Merriam-Webster]
2 : a disturbed state of consciousness in which the one affected seems to perform acts in full awareness but upon recovery cannot recollect the acts performed
People can also talk about losing time or having blackouts.
More casual, and figurative, references to this type of thing include the word sleepwalking and the phrase on autopilot.