Many kinds of oscillators are governed by laws that mean that they oscillate with the same frequency (or nearly the same frequency) no matter what the amplitude of the oscillation is. If you raise a pendulum higher, it covers more distance with each swing, but it also moves faster at the bottom of the swing, so that the frequency stays the same (or at least close enough for practical purposes).
When you give something (oscillator or not) a push in the direction it's already going at that moment, it gains energy.
When something is oscillating, the only way to continually give it pushes in the same direction it's already going is for those pushes to share the same frequency (by reversing direction when the oscillator does, or by always pushing in the same direction but only doing it when the oscillator goes in the same direction).
A steady push in one direction will be going with the motion of the oscillator half the time, and against half the time, so it adds up to nothing.
A periodic push with a frequency that's different from the oscillator's frequency will spend part of its time "in phase" (pushing with the oscillator's motion) and part of its time "out of phase" (pushing against the oscillator's motion). Over a long enough period of time, these contributions add up to zero, and no net energy is added.
An ideal oscillator, driven at its natural frequency, would gain energy forever, and its amplitude would increase forever, but this isn't possible in the real world. Real oscillators all lose some amount of energy to the outside world with each cycle, the amount of energy lost increasing as the amplitude increases. A driven oscillator will reach a steady state when the rate of energy gain equals the rate of energy loss.