In Chromium it's quite literally a CSS animation:
https://source.chromium.org/chromium/chromium/src/+/main:thi...
All the code in that file is a fun read. <marquee> was rewritten as if it was a web component using the public DOM APIs (ex. It uses CSS animations and requestAnimationFrame).