We demonstrate the existence of universal features in the finite-time thermodynamics of quantum machines by considering a many-body quantum Otto cycle in which the working medium is driven across quantum critical points during the unitary strokes. Specifically, we consider a quantum engine powered by dissipative energizing and relaxing baths. We show that under very generic conditions, the output work is governed by the Kibble-Zurek mechanism; i.e., it exhibits a universal power-law scaling with the driving speed through the critical points. We also optimize the finite-time thermodynamics as a function of the driving speed. The maximum power and the corresponding efficiency take a universal form, and are reached for an optimal speed that is governed by the critical exponents. We exemplify our results by considering a transverse-field Ising spin chain as the working medium. For this model, we also show how the efficiency and power vary as the engine becomes critical. © 2020 authors. Published by the American Physical Society. Published by the American Physical Society under the terms of the Creative Commons Attribution 4.0 International license. Further distribution of this work must maintain attribution to the author(s) and the published article's title, journal citation, and DOI.