It is unclear from your question where the html element is on the product page that you wish to show/hide. If it is in the details.phtml
template you can extend this in your module or theme at
Magento_Catalog\templates\product\view\details.phtml
Check for your custom attribute and apply the css class name to the html element you want to hide/show:
<?php
$productView=$block->getLayout()->createBlock('Magento\Catalog\Block\Product\View');
$product=$productView->getProduct();
?>
<div class="<?= ($product->getCustomAttributeName()==='hide' ? 'hide':'') ?>"</div>
You will find many examples on how to create custom modules for Magento 2. One useful tool is the Mage2Gen module creator which lets you quickly build the files you need for your module template.