Class instances (=objects) stay in memory, references to the instance are stored in variables and in HashMap values. When no references remain to the instance, then at some point Java VM garbage collector may free the memory, if it feels like it.
A reference disappears when the variable it is in gets new value (another instance or null), or goes out of scope. So, if you want to get rid of an instance in a Map value, you can either remove its key from map, or keep the key but set value to null. Usually you remove, keeping nulls in a Map is usually not something you want to do unless you have to. If no other reference remain, then instance becomes eligible for garbage collection.
Note about difference to C++: in Java there is no destructor for cleanup (finalize method is not guaranteed to be called ever). If a Java class has resources like files or network connections that should be closed when done, then the class needs a close method, and the programmer is responsible of calling it explicitly (often in try...finally block even if there is no catch), when he's done with the object.