There are several good books on this subject. Of the half dozen on my shelf the ‘Battle of Wits’ by Stephen Budiansky is most complete on the subject of the Polish effort.
A. As pdf27 wrote it started with hiring some young mathmaticians. The Polish army captain in charge of the effort was frustrated with the failure of traditional techniques & hired a recently graduated Doctor of Mathmatics. This man had specialized in the mathmatics for insurance arcturial study, a obscure but demanding part of the statistical branch of mathmatics. Several others like him were recruited in the next year or two. & before 1930 this tiny group had through the analysis of thousands of German radio messages discovered the keys for several proving it could be done. They also gradually over several years came to understand the actual mathmatics underlying the rotor encryption system of the Enigma machines.
B. Polish intellegence agents managed to divert for a few hours a Enigma machine during shipment from its factory. They were able to unpack, examine, and photograph the machine without the Germans figuring it out. The Poles had already modeled what they thought the machines mechanical system looked like. This allowed them to build working models, confirm or refine their mathmatical models, and began reverse engineering the system of rotors and electrical circuts to build decryption machines.
C. A French spy passed a operators manual for the Enigma machine to the French intel service. The French knew the Poles also had a interest in this and gave them a copy of the book. That confirmed for the Poles how the machine was actually used and gave them some clues as to flaws or weaknesses in the operators use of the machine.
D. From the moment the Germans began using the Engima machines, around 1924, the Poles built a huge data base of the German message traffic using it. From this they were able to find flaws in the way the Germans used the system, which simplified finding the encryption keys or initial settings of the rotors and plug board.
The budget for the Polish signals intelligence department was extremely small and part allocated to the Enigma research was of course much smaller. It took about twelve years for a dozen or so mathmaticians, military intel specialists, and radio engineers, to pick apart the basics of the Enigma machine and devise a practical encryption breaking system to apply to it.