We can encode a qubit in the energy levels of a quantum system. Relaxation and other dissipation processes lead to decay of the fidelity of this stored information. Is it possible to preserve the quantum information for a longer time by introducing additional drives and dissipation? The existence of autonomous quantum error correcting codes answers this question in the positive. Nonetheless, discovering these codes for a real physical system, i.e., finding the encoding and the associated driving fields and bath couplings, remains a challenge that has required intuition and inspiration to overcome. In this work, we develop and demonstrate a computational approach based on adjoint optimization for discovering autonomous quantum error correcting codes given a description of a physical system. We implement an optimizer that searches for a logical subspace and control parameters to better preserve quantum information. We demonstrate our method on a system of a harmonic oscillator coupled to a lossy qubit, and find that varying the Hamiltonian distance in Fock space -- a proxy for the control hardware complexity -- leads to discovery of different and new error correcting schemes. We discover what we call the $sqrt{3}$ code, realizable with a Hamiltonian distance $d=2$, and propose a hardware-efficient implementation based on superconducting circuits.