Both refer to the past, in different ways. The first is a bit unlikely though, possibly due to an error.
Did you remember to lock the door?
At some point in the past, you should have locked the door. That was your plan, your purpose. You would have engaged in this task; "you lock the door". But, you may have forgotten to do so! You will only have locked the door, if you remembered to. This asks whether you remembered to do so.
Yes, I remembered to [lock the door].
Oh no! I forgot to lock it!
To slightly alter your first:
Do you remember locking the door?
You may or may not have engaged in the act of locking the door. If you did lock the door, you may or may not have a memory of doing so. You are being asked if you have such a memory now. That is, the question is about your present-time memory about the past time event.
I remember locking the door. (You can picture yourself when you did it, key in hand, locking the door).
I didn't lock the door. (You've no memory, because you know you didn't do it).
I don't remember locking the door. (You've no memory, but it's not impossible that you did lock it, and now forget).
So. The first is about a past memory that you were meant to do something, the second about a present memory of having done something.
Your original sentence:
Did you remember locking the door?
This asks whether, at some point in the past, you had a memory of locking the door, at some point further in the past. It's a less common construct, but does make sense in some contexts.
Why where you sure nobody would enter? Did you remember locking the door?
The main thing is that:
- "Remember + infinitive" is about an intent or purpose. "I must remember to scan over this answer for mistakes"
- "Remember + gerund" is about a completed action. "I don't remember having to learn how different verbs work when followed by infinitives or gerunds, and it can be one of the hardest things for native speakers to explain to learners".