When I think about capacitors, I like to think about water, and capacitors as tanks with flexible membrane in them.
If the water is flowing only one way, it can only flow into the capacitor until it is full. In the water analogy, until the membrane has been pushed as far across as the water pressure can push it. Note that in doing so, it would push water out of the other side.
If the water was flowing in both directions, the membrane would be first pushed one way (expelling water from the other side) then drawn back (allowing the other side to fill up again)
In the first case water seems to flow for a while then stop. In the latter case the water seems to flow back and forth with little impediment.
An astute observer who knows the inner structure will realise that the water which appears to flow through the capacitor is actually different water that was already stored on the other side of the capacitor. No water flows through, but the "push" from one side is transferred to the other. AN even more astute observer would note that it's not even the "push" that is transferred, but changes in the "push".
As AC (sine wave at least) is continually changing, a capacitor sees a continuing change in push and this is transferred across.
For DC, the capacitor sees a one time change (when it is turned on or off) and that change is transferred across, but it rapidly falls back to zero as the DC stops changing.
So you get a common use of a capacitor, you block a constant voltage, but allow through any changes -- these are typically used in amplifiers to allow the audio signal through, but not any DC component.