The top does the acting-on in a scene, the bottom receives it — roles in play, not necessarily who holds power.
Two dimensions get collapsed into these words all the time, so let's separate them. Top/bottom is about the physical direction of a scene — who delivers the sensation, the rope, the impact, the penetration, and who is on the receiving end. Dom/sub is a psychological axis — who holds authority in a power exchange. They often travel together, but they're not the same axis: you can be a top who takes no authority (a "service top" who does exactly what the bottom asks), or a bottom who runs the whole show. Topping and dominating are separate hats; wearing one hands you nothing about the other, in either direction.
The other classic mix-up: "bottom" does not mean the passive or weak one. In kink the bottom is receiving by design, not by default — often the person the scene is built around, negotiating the limits and pulling the emergency brake. The word describes a direction of flow, not a ranking of nerve.
Worth knowing the two lineages: there's the BDSM sense above (who acts / who receives), and the sexual-position sense common among gay men (who penetrates / who is penetrated). Same words, overlapping but not identical maps — and neither is literally about who is physically on top of whom. Someone who moves comfortably between roles is a switch (kink) or versatile (position).
These aren't neutral dictionary terms borrowed from nowhere. They come out of specific communities — mid-century gay leather culture and the BDSM scene that grew alongside it — and the flagging systems that signaled them (coloured handkerchiefs, keys) belong to that same gay male subculture. When straight and pansexual scenes adopted the vocabulary later, they inherited it; they didn't invent it.