We have developed a novel ab initio Gamow in-medium similarity renormalization group (Gamow IMSRG) in the complex-energy Berggren framework. The advanced Gamow IMSRG is capable of describing the resonance and nonresonant continuum properties of weakly bound and unbound nuclear many-body systems. As test grounds, carbon and oxygen isotopes have been calculated with chiral two- and three-nucleon forces from the effective field theory. Resonant states observed in the neutron-dripline 24O are well reproduced. The halo structure of the known heaviest Borromean nucleus 22C is clearly seen by calculating the density distribution in which the continuum s channel plays a crucial role. Furthermore, we predict low-lying resonant excited states in 22C. The Gamow IMSRG provides tractable ab initio calculations of weakly bound and unbound open quantum systems.