An inflationary gap occurs when the demand for goods and services exceeds production capacity, leading to upward pressure on prices. This situation typically arises during periods of strong economic growth, where increased consumer spending outpaces the economy's ability to produce, causing inflation.