Modal pop-up HTML code works on other sites or HTML viewers but not in the custom HTML block within a wordpress page?

There are a couple of issues with what you are trying to do. See this for reference: WordPress support for Custom HTML blocks

First, you cannot reliably add JS code directly into any block, which is intended only for HTML and text. While the script tags may technically be HTML, your JS code certainly is not HTML or text. In the supplied link you see the list of supported tags and script isn’t one of them.

My suggestion would be to create a shortcode for this.

Second, for security reasons an iframe is only allowed on plug-in enabled sites. According to this, your site would need to be Business, Commerce or Enterprise. Plugin Enabled Sites

Sorry, there isn’t a quick fix.