A mechanism is a part of a machine that performs a certain function.
I can’t open my car door because the locking mechanism is broke.
Example picture