If you, as a nation, have the capability to decode communications, then why give that up?
This is a fallacious assumption, and probably the source of your confusion. Destroying the bombes did not amount to the British "giving up" their code breaking capabilities, as the bombes were essentially mechanical ASICs, designed specifically to break the encryption provided by the Nazi Enigma systems. With the defeat of the Nazis, there was simply no need to break Enigma encoded messages on an industrial scale, as there was no one broadcasting such signals in range of British listening stations. So, for almost all practical purposes, these devices became useless with the fall of the Nazi regime. However, the minds behind those machines were still available to the British government, and if needed, they could be called on to build new bombes, or similar machines to break different cipher systems.
The danger of keeping these devices around is that they revealed just how good the British had become at code-breaking, which was a secret that was very closely held. The bombe has even been referred to as the most important machine in the history of Britain, which may be an overstatement, but it certainly had a huge impact on the course of the war. Had the Germans known, they would have undoubtedly deployed countermeasures that the British may not have been able to penetrate, and the massive advantage the British enjoyed would have been lost. This thought was certainly on Churchill's mind as he pondered the fate of these devices - the defeat of the Nazis did not mean that all of Britain's enemies and adversaries were vanquished, and revealing their incredible code-breaking ability to adversaries (such as the USSR) would have been a huge strategic blunder. It was safer, and more prudent, to destroy the now-obsolete machines that were evidence of their code-breaking proficiency, and enlist the mathematical geniuses behind the bombes to build new machines to break the new or different codes that would be used by other countries going forward.
that ability should, if nothing else, discourage others from even trying, or at least give a head start in case someone did try to use encrypted communications.
Well, two things here. It's actually much more advantageous to have someone communicate in a code they think is unbreakable, but that you can listen in on, than it is to try to discourage encryption. If your adversary thinks you can break their code, they'll use a different code, and/or change the medium to one that you can't intercept (directed radio waves, in-person couriers, etc.), but if they're confident you can't listen in, they'll communicate freely and allow you listen in by breaking their "unbreakable" code.
Secondly, the foundations of cryptanalysis were already established by the minds at Bletchley Park, and the bombes, specifically, wouldn't really help much in advancing code breaking on whatever the next cipher was going to be. The real magic behind the machines was the mathematics and the cryptanalytical theory/techniques that underpinned the machines. This is what was valuable for future use. And again, the best way to keep this capability a secret was to destroy the physical evidence (the machines themselves) and keep the minds behind them working in secret.