8 divides cleanly at every common display density. at 1× it is 8 physical pixels, at 1.5× it is 12, at 2× it is 16, at 3× it is 24 — all whole numbers. a 5pt grid gives you 7.5 physical pixels at 1.5×, and the browser rounds it, and your careful spacing drifts by half a pixel in a direction you don't control.
the second reason is arithmetic you do in your head. multiples of 8 are easy to hold — 8, 16, 24, 32, 48, 64 — so a team converges on the same values without checking a document. that consistency is the actual product; the number 8 is just a convenient carrier.
4pt as the half-step. pure 8 is too coarse inside small components — the gap between an icon and its label, the pad on a compact chip. most systems run an 8pt grid with 4pt available below sm. that's what the base unit toggle is for.