Motivated by observations in Hudson shelf valley showing stronger onshore than offshore flows, this study investigates wind-driven flows in idealized shallow shelf valleys. This first part of a two-part sequence focuses on the mechanism of the asymmetrical flow response in a valley to along-shelf winds of opposite directions. Model simulations show that (i) when the wind is in the opposite direction to coastal-trapped wave (CTW) phase propagation, the shelf flow turns onshore in the valley and generates strong up-valley transport and a standing meander on the upstream side (in the sense of CTW phase propagation) of the valley, and (ii) when the wind is in the same direction as CTW phase propagation, the flow forms a symmetric onshore detour pattern over the valley with negligible down-valley transport. Comparison of the modeled upstream meanders in the first scenario with CTW characteristics confirms that the up-valley flow results from CTWs being arrested by the wind-driven shelf flow establishing lee waves. The valley bathymetry generates an initial excessive onshore pressure gradient force that drives the up-valley flow and induces CTW lee waves that sustain the up-valley flow. When the wind-driven shelf flow aligns with CTW phase propagation, the initial disturbance generated in the valley propagates away, allowing the valley flow to adjust to roughly follow isobaths. Because of the similarity in the physical setup, this mechanism of arrested CTWs generating stronger onshore than offshore flow is expected to be applicable to the flow response in slope canyons to along-isobath background flows of opposite directions.