The base class and its derived class have different destructor names
Destructors don't have names. Like constructors, they're referred to via the name of the type being constructed or destroyed, but they are not regular functions and don't have regular function names.
Could you explain what happens when a destructor is declared as a virtual function?
It just tells the compiler that the destructor is virtual. Nothing "happens" at declaration time.
If you mean what happens when an object with a virtual destructor is destroyed, then the answer is virtual dispatch.
Unlike a regular function, the dispatch is to the most derived type's destructor, rather than the most derived method override with the same name, because destructors are not regular functions and don't have regular function names.