The 26-year-old Ivory Coast-born defender is Hamburg's second signing out of season after Cameroon striker Jacques Zoua joined from Basel.
Djourou spent the last six months of last season on loan at another Bundesliga side, Hanover.
His move to Hamburg had been predicted in earlier media reports.
The German club's sporting director Oliver Kreuzer said Djourou was just the type of defender they had been looking for.
"He ticks all the boxes in terms of what we wanted," he said.
"I am satisfied with the way that our recruitment for next season is going."
Hamburg are also pursuing veteran Paraguayan striker Roque Santa Cruz, who was sent out on loan by 2012 Premier League champions Manchester City to Spanish side Malaga last season, as well as defender Lasse Sobiech of Bunbdesliga rivals Borussia Dortmund.