Trying to create a mouseover effect in html using Gutenberg editor

You were very close. You just had a single-quote swapped with a double-quote after the onmouseover.

<figure class="wp-block-image">
    <img src="https://website.com/wp-content/uploads/2019/08/image1.png" onmouseover="this.src="https://website.com//wp-content/uploads/2019/08/image2.png";" onmouseout="this.src="https://website.com/wp-content/uploads/2019/08/image1.png";" alt="alttext" class="wp-image-1111"/>
</figure>

I usually place semi-colons after the single-quotes to make it easier to tell when your quotes are balanced, whether Javascript requires it, or not.