I get this error on multiple WordPress sites I run, when I try paste a YouTube video or use the shortcode [embed]:
This only happens with YouTube. Other media websites such as Vimeo has no problem with the embed.
This may be due to a failed network request from the server to youtube. If the server cannot reach YouTube, the embed will show as "failed to embed" in the editor.
You can fix the problem by allowing the server to make network requests to youtube.
The WordPress Proxy documentation may be helpful, https://developer.wordpress.org/reference/classes/wp_http_proxy/
WordPress core code -