The Moon and the earth attract each other, why does it not collapse into Earth?
Due to the centripetal force which is the force of gravity exerted by earth on the moon.
When the moon is revolving around the earth, it is actually getting accelerated towards earth in such a way that the radius of the orbit remains constant.
The acceleration towards the earth (called centripetal acceleration) is caused by earth's gravity which acts as a centripetal force.