Locks work by taking the advantage of water running down hill. The water is raised by closing the downstream pipe, filling up the box. Anything floating in the box will raise. Closing the upstream...
Locks on canals exist because you need level water to be able to boat, sail or barge from one point to another. Unlike a road, a river or a canal cannot have a hill. Hills on water are called rapids...