Carry, who made his international debut at the Commonwealth Games in Manchester in 2002, swam a new personal best time to qualify for the Olympics where he competed in the final of the 400m freestyle - finishing seventh.
“After 10 years in the sport, I am thrilled with how I performed at the Olympics - it was a fitting end to my career,” said Carry. “To swim so well in my last competition was fantastic but it’s now time for a new chapter in my life.
“I’d like to thank everyone at British swimming for their help and support throughout my career.
“I have made so many amazing friends on the team and have shared some big highs and lows with them and I’m proud to have been a part of that.
Michael Scott, National Performance Director for British Swimming said: “I would like congratulate David on a successful career for Great Britain on the Olympic and World stage and for Scotland at the Commonwealth Games.
“To be a three-time Olympian, Double Commonwealth Champion and multi-World and Olympic Finalist are all outstanding achievements.
"From all at British Swimming I wish David all the best in his new career.”