The 30-year-old Scotland international lock will take up a contract with an undisclosed French club.
Gloucester say they have received a financial settlement to compensate them for the final year of Hamilton's contract with them, season 2013-14.
Hamilton joined Gloucester from Edinburgh in 2010. He previously played for Leicester and has won 41 Test caps.
"The time I've spent at Gloucester has been the best of my career," he said.
"It has been an honour and a privilege to wear the Cherry and White shirt, to represent the city and the supporters and, of course, to captain the side.
"However, the offer from France is simply the opportunity of a lifetime and one that I just couldn't ignore. It's a great move for myself and for my family. I hope everyone will understand that.
"Nigel Davies (Gloucester rugby director) and the club have been terrific about it, and I can't thank them enough for that.
"When the time comes, I will leave Gloucester with a heavy heart. I have made friends for life here, it has been a special place to play my rugby and I wouldn't have left to join another English club side.
"I am fully committed to this season being one of real success for Gloucester, and I hope to bow out on a high."
Davies admitted that the financial clout currently enjoyed by France's Top 14 clubs had surfaced.
"It is a fact of life in the modern game that the French sides currently have much bigger playing budgets than their English counterparts," he said.
"Jim is a fine player, an experienced international, and has been a big part of what we've achieved so far this season.
"However, the offer is significant, and it would be wrong of us to try and stand in Jim's way. It's a massive opportunity for him. We don't want to lose him, and he is aware of that.
"We are not the first team to lose a player this way. We won't be the last."
Davies, meanwhile, stressed that a suitable second-row replacement would be sought for Hamilton.
"I must stress to the Gloucester supporters that this does not signify a lack of ambition on the part of the club," he added.
"We will, of course, be seeking a suitable replacement for Jim as we seek to establish Gloucester as a force in domestic and European rugby.
"In the meantime, I know that Jim will continue to be 100 per cent committed to Gloucester in the time he has left at the club."
Gloucester announced that 32-year-old Tonga international lock Lua Lokotui had signed for the club.
Lokotui, who scored a try when Tonga beat Scotland in Aberdeen last month, has previously played for French club Stade Francais and the Wellington Lions in New Zealand.
He was also a member of Tonga's 2011 World Cup squad in New Zealand.
Davies has moved for a second-row addition after Alex Brown injured his shoulder earlier this season.
"We've effectively been a man down since Alex Brown injured his shoulder in the opening game of the season," Davies said.
"Jim Hamilton and Will James have been superb, and Tom Savage has done a great job there when required.
"But, with Elliott Stooke also currently injured, we did need to being someone else in. Another injury would have left us seriously stretched.
"Lua brings a big physical presence and international experience to the table, and we are delighted to welcome him on board."
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The entire All Blacks apparel line has been updated for 2013/14. Check out the New Zealand All Blacks polo.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Gilbert Blitz 8S rugby cleat is a great cleat at a great price of $69.99. Get a new pair of cleats today.
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
$29.99
The All Blacks Performance t-shirt is black with hints of blue from the training jersey. Very Cool.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.