The country isn't flat. So for the canal to move through higher and lower parts there needed to be something to help with that. Locks were developed to overcome this problem. Put simply, a boat moves into a chamber, the gates are closed at both ends, and the water level within the chamber is raised or lowered to match the level on the other side. Then the boat can move out at the new level.