What exactly does it mean when a surgeon "cleans out" a joint?

Remove disease. Of course, each joint is different, but a classic example of what you are asking about is a knee arthroscopy the removes any loose or torn cartilage, whether it is the cartilage on the ends of the bones (femur, tibia, patella) or tears of the rubbery meniscal cartilage. The surgeon might also remove thickened joint lining (synovium) or other scar present within the knee.
Arthroscopy? I guess they are saying that during arthroscopy they will remove the growth of bone or prominent surfaces of bone and excessive sinovial cells that may cause pain or swelling unless there is an infection they will remove ( drain) the pus. If is the knee...I assume that they will check the meniscus and remove the broken ones unless they may repair them. Ask your orthopode.
Scope. Generally a clean out refers to an arthroscopic evaluation or a scope.