An upper limit, and the thing that closes a top. Both stop what would otherwise keep going.
Late Latin cappa (a head-covering, a hood), possibly related to caput (head); the limit sense is a later metaphorical extension of the thing that closes a top.
An upper limit on a value, and a covering that closes a top — both stop what would otherwise keep rising or spilling out.