Dams and locks are used to make a river navigable. The dams make the water deeper for boat traffic. The smoothly flowing river becomes are series of stair stepping reservoirs.
The locks are there to allow the boats to go from one reservoir level to another. A lock is an enclosure that is large enough for a ship to enter with gates on each end. Suppose a ship wants to go upstream. The downstream gates would open, the ship would enter the lock at the downstream elevation and the downstream gates would close. The upstream gates would then open allowing water to flow into the lock, slowly filling lock and lifting the ship to the level of the upstream reservoir. Once the lock is full of water the upstream gates would open and the ship would navigate its way to the next lock or its destination. Reverse these steps for a ship going downstream.
Dams and locks are still in use. That's how ships navigate the Panama Canal. I recently checked out a lock on the Tombigbee Waterway in Alabama.