Ideally, the choice may best be driven by what's natural for the problem/solution domain. Does the Key<class, Boolean> represent anything in the domain? Does Map<Boolean, String> represent anything in the domain? Using 1-level or 2-levels of indirection may be an implementation detail you end up wanting to hide.
However, if it is purely a performance decision, all other things being equal (e.g. access pattern doesn't favor one way or the other, good hash function, sparse map, etc.), I would think HashMap<Key<X, Y>, Z> would be faster than HashMap<X, Map<Y, Z>> - I want to think that 1 lookup in a larger HashMap is faster than 2 lookups in smaller maps.
Since you have a boolean key, also consider 2 HashMap tables (one for true and one for false) and some ternary operator (?:) magic instead:
final Map<Class, String> falseMap = new HashMap<Class, String>();
final Map<Class, String> trueMap = new HashMap<Class, String>();
final String s = ((booleanKey ? trueMap: falseMap).get(classKey));