We show how a fermionic quantum gas in an optical lattice and coupled to the field of an optical cavity can self-organize into a state in which the spontaneously emerging cavity field amplitude induces an artificial magnetic field. The fermions form either a chiral insulator or a chiral liquid carrying edge currents. The feedback mechanism via the cavity field enables robust and fast switching of the edge currents and the cavity output can be employed for non-destructive measurements of the atomic dynamics. The controlled generation of topologically non-trivial quantum phases is of greatest interest since they possess special properties such as extended edge states that can be well protected against destructive environmental effects[1]. Thus, materials with topological non-trivial properties have the prospect to be utilized for quantum devices and quantum computing. Well known are topological insulators with protected edge currents created in quantum Hall devices [2] by strong magnetic fields.For neutral atoms strong artificial magnetic fields can be created [3] which act similarly as magnetic fields for charged particles. Such artificial magnetic fields have been used in quantum gases confined to optical lattices to realize two showcase models of topologically insulating phases, the Hofstadter model in two-dimensions [4][5][6][7] or on a ladder geometry [8] and the Haldane model [9].Yet, the dynamic control and detection of topologically non-trivial quantum states remains a great challenge. In order to overcome this difficulty, in this work the dynamical feedback between atoms and an optical cavity is employed to reach a self-organization of topologically non-trivial phases. One fascinating example for a selforganization of a coupled atom-cavity system has been realized recently by placing a bosonic quantum gas into an optical high-finesse resonator subjected to a perpendicular off-resonant pump beam [10][11][12][13][14]. Above a critical pump strength, the occupation of the cavity mode is stabilized and the bosonic atoms organize into a checkerboard density pattern [12]. Many different proposals have been put forward to realize the self-organization of more complex quantum phases [13] reaching from the Mott-insulator [15] over fermionic phases [16][17][18][19][20] and disordered structures [21][22][23][24] to phases with spin-orbit coupling [25][26][27].In this work, we engineer a direct coupling mechanism of the cavity photons to the tunneling of atoms in an optical lattice. This is achieved using a Raman transition induced by the combination of a transverse pump beam and the cavity field (Fig. 1). The frequencies of the pump beam and the cavity mode are chosen such that the energy transfer is close to the energy offset between neigh- boring lattice sites. The resulting process represents an effective tunneling of the atoms. Due to the running-wave nature of the pump beam, a phase ϕ can be imprinted onto the tunneling of the atoms around a plaquette in the presence of cavity photons. We demonstrate that due t...