woocommerce retriving category name as div class?

I’m guessing you haven’t set or called the $product object, so it can’t access any information in it.

Try inserting global $product just before your while loop.

If that doesn’t work, try doing a print_r($product->get_categories() outside of your html for debugging.

Without the rest of your code I cannot suggest anything else. Also, you should either make sure not more than one category per product is assigned, or take care of that in your code too.