In A.D. 825, construction started on the Hammaburg, or Hamma Castle, on ground between the Elbe and Alster rivers. It is from this structure that the city takes its name.
"Berg" means castle, and is a commonplace component of names in Germany.
The meaning of "hamma," later shortened to "ham," is much less certain. Scholars have proposed several different ideas about what it means.
"Ham" might mean "river bend." Possibly it refers to the beech forest that used to characterize the area. It might also be a term for the watery meadow that also characterized the area ("marsh castle," in other words).
In any case, the name "Hamburg" has traveled, with about twenty towns and other jurisdictions of that name in the United States. More importantly, the city lent its name to the meat sandwich eaten around the world.