A lock raises or lowers boats on a waterway when its chamber is filled or emptied. It's like an elevator for boats.
The upstream side of a waterway is closer to the source, and is higher. In the case of the St. Lawrence, the upstream side is to the west, toward the Great Lakes. The downstream side is closer to the mouth of the waterway and is lower. In the case of the St. Lawrence, the downstream side is to the east, toward the Atlantic. If a boat is headed downstream, it needs to be lowered, while if it is headed upstream, it needs to be raised.
Locks have a number of parts.
Chamber: A sealed basin with gates at either end.
Upper gates: Gates facing the higher side of the waterway.
Lower gates: Gates facing the lower side of the waterway.
Filling valves: Valves on the upstream side that make it possible to raise the water level using gravity.
Emptying valves: Valves on the downstream side that make it possible to lower the water level using gravity.