We treat the Cooper pairs in the superconducting electrodes of a Josephson junction (JJ) as an open system, coupled via Andreev scattering to external baths of electrons. The disequilibrium between the baths generates the DC bias applied to the JJ. In the weak-coupling limit we obtain a Markovian master equation that provides a simple dynamical description consistent with the main features of the JJ, including the form of the current-voltage characteristic, its hysteresis, and the appearance under AC driving of discrete Shapiro steps. For small dissipation, our model also exhibits a self-oscillation of the JJ's electrical dipole with frequency ω = 2eV / around mean voltage V . This self-oscillation, associated with "hidden attractors" of the nonlinear equations of motion, explains the observed production of non-thermal radiation with frequency ω and its harmonics. We argue that this picture of the JJ as a quantum engine resolves open questions about the Josephson effect as an irreversible process and could open new perspectives in quantum thermodynamics and in the theory of dynamical systems. CONTENTS I. Introduction II. Need for open-system approach A. Macroscopic wave function B. RCSJ model C. Feedback in engines III. Irreversible dynamics A. Markovian master equation B. Josephson Junction model IV. Current-voltage characteristic A. Critical and re-trapping currents B. Stability and hysteresis C.