Answer
Earth has atmosphere which prevents over heating of the earth during day time. On the other hand Moon does not have atmosphere hence it appears to be hotter during day time. Lack of atmosphere in moon also allows the heat to escape during night because of this phenomenon temperature varies on moon surface.