I think the Travel Agencies are "assigned" a block of rooms by the cruise lines.
So... some TA will "sell out" their block of rooms although there are many available rooms left on the ship (either under the control of the cruise lines or another Travel Agency).
If your TA has "extra rooms" from their allotment, just prior to cruise departure and you are a REPEAT and LOYAL customer of the TA, then you might be awarded an upgrade from the room you have chosen to an "extra" room of a higher category which remained unsold.
When I have been "upgraded" by the cruise line, I find the room I originally booked was in a better location than the room which I was upgraded to. Room # FF1818 on the Rotterdam is a nightmare. With the 2 category upgrade policy, I was "Guaranteed" an FF level room. I will never again take a Guarantee and I will research the room locations for upgrades very carefully.
These rooms are "leftover" for a reason.