  The density structure of the interstellar medium (ISM) determines where stars
form and release energy, momentum, and heavy elements, driving galaxy
evolution. Density variations are seeded and amplified by gas motion, but the
exact nature of this motion is unknown across spatial scale and galactic
environment. Although dense star-forming gas likely emerges from a combination
of instabilities, convergent flows, and turbulence, establishing the precise
origin is challenging because it requires quantifying gas motion over many
orders of magnitude in spatial scale. Here we measure the motion of molecular
gas in the Milky Way and in nearby galaxy NGC 4321, assembling observations
that span an unprecedented spatial dynamic range ($10^{-1}{-}10^3$ pc). We
detect ubiquitous velocity fluctuations across all spatial scales and galactic
environments. Statistical analysis of these fluctuations indicates how
star-forming gas is assembled. We discover oscillatory gas flows with
wavelengths ranging from $0.3{-}400$ pc. These flows are coupled to
regularly-spaced density enhancements that likely form via gravitational
instabilities. We also identify stochastic and scale-free velocity and density
fluctuations, consistent with the structure generated in turbulent flows. Our
results demonstrate that ISM structure cannot be considered in isolation.
Instead, its formation and evolution is controlled by nested, interdependent
flows of matter covering many orders of magnitude in spatial scale.
