A study of boundary-layer-ingesting flow in an upper-mounted offset inlet in NASA’s hybrid wing body transport concept for achieving environmental and performance requirements has been carried out. This study aims specifically at minimizing flow distortion stemming from the ingested low-momentum fluid to the level acceptable to the operation of fan blades. In this paper, we will focus on using a discrete adjoint method to arrive at an optimized wall geometry, which is parametrically represented by design variables, for transonic turbulent flows described by 3D Navier–Stokes equations supplemented with turbulence model. Of special interest herein is the flow physics resulting from optimization, revealing the intricate connections to the remarkable reduction in flow distortion and total pressure losses at the engine face. It is discovered that the counter-rotating vortex pair commonly seen in an S-inlet is eliminated by energizing both the core and boundary layer fluids through the change of wall shape by a series of peaks and valleys. Their exact forms, magnitudes, and locations, unknown a priori, are determined by the discrete adjoint method. The optimal shape, moreover, still holds similar level of superior performance at off-design conditions. The result may suggest a possible paradigm shift in flow control concept, away from disruptive penalty ridden devices, by properly conditioning and guiding the flow.