When the door is closed, a connection inside the lock powers an electrical coil wrapped around the bimetal part. This heats up the metal, which then bends.
In front-load washers, this piece of pliable plastic forms a seal when the door is closed, preventing any of the wash water that is touching it from escaping.