Djourou, who undertook his medical with the northern Germany club on Monday morning before putting pen to paper on his contract, spent the second half of last season on loan with Hamburg's Bundesliga rivals Hannover after joining during the January transfer window.
Djourou said on Hamburg's official website: "I'm very happy now that everything is sorted. HSV are a big club, with a lot of quality and great fans.
"I am convinced that this is the right step for my career."
Hamburg's director of sport Oliver Kreuzer said: "Johan was a priority as the defence is a very important part of our team. He has leadership qualities but is also fast, good in the air and very good on the ball."
The versatile Ivory Coast-born defender joined Arsenal as a 16-year-old in 2003 and has made 144 appearances for the Gunners.