Why do astronomers believe that in the past galaxies were closer to each other than they are now?

Because they have been measured by red shift and other means to be moving away from us. The ones farthest are moving the fastest too.