We use 'the' for something specific:This is the key, it opens the lock.
I'm talking about a specific key that opens a specific lock.
We us 'a/an' for things that are not specific:
This is a key, it opens a lock.
I'm talking about any key, and any lock. It is not specific.