We analyse the output of the hi-res cosmological zoom-in simulation ErisBH to
study self-consistently the formation of a strong stellar bar in a Milky
Way-type galaxy and its effect on the galactic structure, on the central gas
distribution and on star formation. The simulation includes radiative cooling,
star formation, SN feedback and a central massive black hole which is
undergoing gas accretion and is heating the surroundings via thermal AGN
feedback. A large central region in the ErisBH disk becomes bar-unstable after
z~1.4, but a clear bar-like structure starts to grow significantly only after
z~0.4, possibly triggered by the interaction with a massive satellite. At z~0.1
the bar reaches its maximum radial extent of l~2.2 kpc. As the bar grows, it
becomes prone to buckling instability, which we quantify based on the
anisotropy of the stellar velocity dispersion. The actual buckling event is
observable at z~0.1, resulting in the formation of a boxy-peanut bulge clearly
discernible in the edge-on view of the galaxy at z=0. The bar in ErisBH does
not dissolve during the formation of the bulge but remains strongly
non-axisymmetric down to the resolution limit of ~100 pc at z=0. During its
early growth, the bar exerts a strong torque on the gas within its extent and
drives gas inflows that enhance the nuclear star formation on sub-kpc scales.
Later on the infalling gas is nearly all consumed into stars and, to a lesser
extent, accreted onto the central black hole, leaving behind a gas-depleted
region within the central ~2 kpc. Observations would more likely identify a
prominent, large-scale bar at the stage when the galactic central region has
already been quenched. Bar-driven quenching may play an important role in
disk-dominated galaxies at all redshift. [Abridged]