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.
A washing machine's drain function removes water from the tub during the spin cycle. The washer pump forces water from the bottom of the appliance into the drain hose.