Jupiter and Saturn exhibit alternating east-west jet streams. The origin of these zonal flows has been debated for decades. The high-precision gravity measurements by the Juno mission and the grand finale of the Cassini mission have revealed that the observed zonal flows may extend several thousand kilometres deep and stop around the transition region from molecular to metallic hydrogen, suggesting the magnetic braking effect on zonal flows. In this study, we perform a set of magnetohydrodynamic simulations in a spherical shell with radially variable electrical conductivity to investigate the interaction between magnetic fields and zonal flows. A key feature of our numerical models is that we impose a background dipole magnetic field on the anelastic rotating convection. By varying the strength of the imposed magnetic field and the vigor of convection, we investigate how the magnetic field interacts with the convective motions and the convection-driven zonal flows. Our simulations reveal that the magnetic field tends to destroy zonal flows in the metallic hydrogen and suppress zonal flows in the molecular envelope, while the magnetic field may enhance the radial convective motions. We extract a quantitative relation between the magnetic field strength and the amplitude of zonal flows at the surface through our simulations, which roughly matches the observed magnetic field and zonal wind speed of Jupiter and Saturn. This discovery provides support from a new perspective for the scenario of deep convection-driven zonal winds which are confined to the molecular hydrogen layers in giant planets. This study explores the mysterious east-west jet streams, known as zonal flows, observed on Jupiter and Saturn. Data from the Juno and Cassini missions suggested that these flows extend deep into the planets, stopping where hydrogen transitions from a molecular to a metallic state. Here we conduct computer simulations in a spherical shell geometry to understand ho`w the magnetic fields and zonal flows interact in the deep interior of giant planets. We show that magnetic fields disrupt or weaken jet streams, but may enhance radial convective fluid motions. Crucially, our simulations provided a relation to link magnetic field strength with jet stream intensity at the surface, aligning well with real observations from Jupiter and Saturn. This supports the theory that the jet streams on these giant planets are driven by deep convection and are confined to the outer molecular hydrogen layers. We show that the magnetic field suppresses zonal flows in the molecular layer and enhances convective motions We extract a scaling relation between the magnetic field and the zonal flow at the surface that matches observations of Jupiter and Saturn This study provides alternative evidence that the zonal winds on gas planets are deep-seated and convection driven