USA, France, Russia and other countries were trying to break the code. Was is accidental that Britain did it first or did they actually have an edge over other countries (better scientists, budget, intelligence, etc)? Were they all trying with the same effort?
They didn't break the military version first - the Polish did. The British purchased a civilian Enigma machine in the 1920s, and made some attempts at breaking it. The cryptanalyst Dilly Knox managed to solve messages sent in it during the Spanish Civil War. However, the civilian version was significantly different from the military version.
The Polish Cipher Bureau made the most significant steps in deciphering Enigma. Feeling threatened by German rhetoric in the late 1920s, the Poles began a major effort to break the German codes. They were supported in this by materials supplied by Hans Thilo-Schmidt, a German official with access to documentation and Enigma machines. He had been recruited by the French intelligence service. They didn't find the Enigma material to be the most useful, and were willing to supply the material to the Poles. Armed with this material, and a couple of excellent mathematicians, they were able to crack the code in 1932-33. They would develop further techniques to speed up decryption of Enigma messages, including producing electromechanical computers called Bombes - these would be built upon in the UK during the war. Some of this information was shared with the UK and France immediately before the outbreak of war. The remainder would be transferred to France and the UK after the invasion of Poland.
So, why did Poland do it first? Mainly, it was because they were the only people working on it in great depth. The British and French weren't putting many resources towards breaking the Enigma. It was also because the French provided access to the information provided by Hans Thilo-Schmidt.