We present the first lattice QCD determination of the \(\gamma Z\) box contribution to parity-violating electron-proton scattering, \(\square_{\gamma Z}\), a key ingredient for the precise tests of the Standard Model via the proton weak charge. Our calculation covers the electron beam energies up to \(E=155\) MeV. For the axial-vector component, we achieve reduced uncertainties across the entire energy range compared with phenomenological estimates. For the vector component, the uncertainties remain slightly larger after continuum extrapolation. At \(E=0\), where the vector part vanishes, we obtain \(\square_{\gamma Z}=0.00412(9)\), reducing the uncertainty by a factor of 2 relative to the most precise previous determination. Incorporating this result yields an updated weak charge of \(Q_W^p=0.06987(50)\). The calculated energy dependence of \(\square_{\gamma Z}\) further provides a first-principles input for the upcoming P2 experiment at Mainz, which will operate at the optimized beam energy of 155 MeV to extract \(Q_W^p\).