Flotation has garnered increasing attention as an indispensable technology for oily wastewater treatment for sustainable and green development. Bubbles are an essential element during the flotation process. Hence, it is important to examine bubble size control in a bubble generator employed in a flotation deoiling system. Herein, a swirling-flow bubble generator was studied via experiments, simulation, and machine learning methods. As the liquid Reynolds number increased from 16,047 to 32,095, the Sauter mean diameter decreased by 27.3%. Compared to the other open-hole schemes, the spiral-bottom open scheme was advantageous in reducing the bubble size, while decreasing the number of open holes reduced the bubble size further. When the surface tension changed from 0.06 to 0.03 N/m, D 32 decreased by 27.1%. Decreasing the height diameter ratio and increasing the angle between adjacent holes helped generate more smaller bubbles. However, for a given perforation velocity, the bubble size was insensitive to the size of the open holes. The relationship between D 32 and the involved variables was determined accurately by a support vector machine. Finally, a swirling-flow bubble generator with suitable specifications was installed in the flotation deoiling system to achieve an acceptable deoiling performance.