The Enigma was a very save ciphering machine at its time. Because its heavy usage, the operators of the army made errors which allowed the first breaking. The M4 naval enigma was used by more trained people, therefore it was cracked many more years later.
Also, the Germans did modifications on the machine in a step by step procedure which made it easier to detect those modifications.
So with a lot of money and resources the British cracked the Enigma. Expert say that because of the code breakers, the war was over two or three years earlier.