The 26-year-old Djourou started just two games in the Capital One Cup for Arsene Wenger's side last term before being sent out on loan to Hannover in January.
After making 16 appearances, the Bundesliga club was keen to make the defender's move permanent, but the Switzerland international has instead opted to join divisional rival Hamburg, which has an option to buy Djourou at the end of next season.
"I'm very happy now that everything is sorted. HSV are a big club, with a lot of quality and great fans," the center back told the German club's official website. "I am convinced that this is the right step for my career.
"In London I would have earned much more money, but that has not been decisive. I want to play as much as possible and develop myself and I see in Hamburg the optimum requirements."
Hamburg's director of sport, Oliver Kreuzer, added: "Johan was a priority as the defense 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."
Follow GOAL.COM on Twitter
- Sports & Recreation
- Arsene Wenger