How does wordpress blocks?

But how does the actual HTML get on the page? How does that SQL data translate into a page full of blocks?

Normally the HTML for a block is inside the HTML comments.

However, much like shortcodes, ACF blocks are rendered in PHP, so when the post is processed during the_content filter, that block is replaced with the rendered HTML. WordPress knows to do this because ACF registered the block and provided a render callback function to call.

So this is essentially a more modern version of a shortcode with a better UI and developer features ( and the bonus that you don’t get a raw shortcode displayed on the frontend if ACF is deactivated )

As for how ACF then retrieved the data from the database, you would need to ask in an ACF forum, as that is unique to ACF blocks.

HTML not wrapped in the comments is interpreted as classic content from the classic editor when edited.