Auto-translated
This happens in the original Heroes of Might and Magic IV, but the bug was fixed in the add-ons Warlords of the Wastelands and Armageddon's Blade.
Just don't enter the Dungeon. There's almost no need to do so.
And it's definitely not because of a pirated copy; I played the licensed version and encountered this issue all the time.