Originally the canals of Amsterdam had several functions:
they allowed for goods to be delivered from the harbor (and the markets at Dam square and Nieuwmarkt) to storage facilities and stores throughout thecity.
they were used as defence moats
they served to guide the water of the Amstel River through its former delta.
Nowadays its most popular use is recreation.
Taking a canal tour is one of Amsterdam’s top tourist attractions.
Swimming in the canals is discouraged — if not outright prohibited. People do fall in, though. Those who live to tell about it are always taken to a hospital for a tetanus shot.
Note that many of the houseboats lining the canals are not yet hooked up to the city’s sewer system.