Most washing machines have a timer that prevents you from opening the hatch just after the washing cycle ends. Instad you must wait for the timer to go off, usually a minute or two, before you can open the hatch.
Why? Would letting the user open the hatch immediately after washing ends pose any safety or other issues?
Many machines use a bimetal to lock the door, a stupidly simple design. Metal heats up, bends and triggers the lock. It takes a while to cool down which is why it'll take a while to unlock even if you unplug the machine.
In case you'd like to see bigclive explain it in detail: https://www.youtube.com/watch?v=PIm7q_U3UEM