The origin and composition of ultrahigh energy cosmic rays (UHECRs) remains a mystery. The common lore is that UHECRs are deflected from their primary directions by the Galactic and extragalactic magnetic fields. Here we describe an extragalactic contribution to the deflection of UHECRs that does not depend on the strength and orientation of the initial seed field. Using the IllustrisTNG simulations, we show that outflow-driven magnetic bubbles created by feedback processes during galaxy formation deflect approximately half of all 1020 eV protons by 1° or more, and up to 20°-30°. This implies that the deflection in the intergalactic medium must be taken into account in order to identify the sources of UHECRs.