When an object cools down, heat is withdrawn from it. Hence, the entropy of the object decreases. But the decrease in entropy leads to the transfer of energy to the surrounding. The second law is not violated here, which states that entropy of the universe always increases as the net entropy increases.Here,Net entropy = Entropy of object + Entropy of surrounding