1. I forgot to lock the door.

1-1. I forgot that I would/must/should/had to lock the door.

(Are both the same?)

2. I forgot locking the door.
2-1.I forgot that I had locked the door.
(Are both the same?)

The first one is correct.

You could also say: "I forgot that I must lock the door." or "I forgot that I should lock the door." or "I forgot that I had to lock the door."

# 1 is the best.

Both of the sentences for # 2 are correct. They mean that you had locked the door and forgot that you had done that. You'd say this if you locked the door and forgot to take your key with you.

1. "I forgot to lock the door" and "I forgot that I would/must/should/had to lock the door" are not exactly the same, but they convey a similar meaning. The first sentence implies that you simply neglected to lock the door, whereas the second sentence suggests that you failed to remember or consider the act of locking the door.

In the second sentence, using "would/must/should/had to" expresses a stronger sense of obligation or necessity compared to simply saying "to lock." For example:
- "I forgot to lock the door" might imply that it was a minor oversight or forgetfulness.
- "I forgot that I should lock the door" conveys a moral or practical imperative to lock the door.
- "I forgot that I must lock the door" indicates a strict requirement to lock the door.
- "I forgot that I would lock the door" implies a habitual or expected action that you failed to fulfill.

Ultimately, the choice of words depends on the specific context and the level of obligation or necessity you want to convey.

2. "I forgot locking the door" and "I forgot that I had locked the door" have different meanings.

The first sentence, "I forgot locking the door," suggests that you forgot the action of locking the door itself. It implies that you may have locked it, but you failed to remember doing so.

The second sentence, "I forgot that I had locked the door," suggests that you forgot a past event or action of locking the door. It implies that you did in fact lock the door, but you failed to remember that you had done so.

So, these sentences have different implications - the first sentence focuses on the lack of memory of the action, while the second sentence focuses on the lack of memory of the past event.