A good mental model for wood is that trees are a bunch of stacked cones (growth rings) on top of each other.
In the spring it fills with water and the diameter grows but the tree does not get longer because it needs to support a large mass on top and the lengthwise fibers are not able to grow and shrink (they need to be stiff to carry the weight).
Because of this, the circumference of the outermost growth rings need to grow more than the inner ones.
Now cut a board out of it and look at the end grain. Think what happens when the rings closer to the outside need to shrink more than the inner ones for the same humidity change. For a flat sawn board, you will always see it cup so that the concave side is on the outside.
This doesn't explain why boards twist or bow but cupping is the most prevalent wood movement in typical flat sawn boards.
Both are actually explained the same way because in bowing, it dries slower in the middle of the board creating the bow, and twisting is just different type of uneven drying typically due to some open grain drying faster.