So the Polish intelligence selected 3 smartest mathematicians in 1929 and assigned them to the task of understanding the German encryptions. The team (Rejewski) had a breakthrough in 1932 and managed to break the Enigma codes. By 1939 they've broken many subsequent versions of the constantly upgraded ciphers.
In 1939 they gave the British: a working Enigma machine, the broken encryption, a full description of how the encryption works, how to use a machine to speed up the process (the "bomba" appliance), and what automation is needed for the following versions.
The British (Turing et al) then contributed a machine-based automation which allowed to break the following upgrades to the Enigma ciphers, which would be impractical to manual calculations.
As a side note, the Polish codebreaking bureau started with a breakthrough around 1917, when some smart soldiers managed to break Bolshevik radio communication ciphers, which allowed Poland to stop the Russian revolution's expansion by 1920 (the decisive Battle of Warsaw).