The meanings are very different!
I forgot to lock the door. (I’m sure that in the past I didn’t lock the door)
I forget locking the door. (In the present, I’m not sure if I locked the door in the past.)
I forgot locking the door. (In the past, I wasn’t sure if I had locked the door in the more distant past.)