We investigate electronic transport properties of the squashed armchair carbon nanotubes, using tight-binding molecular dynamics and the Green's function method. We demonstrate a metal-to-semiconductor transition while squashing the nanotubes and a general mechanism for such a transition. It is the distinction of the two sublattices in the nanotube that opens an energy gap near the Fermi energy. We show that the transition has to be achieved by a combined effect of breaking of mirror symmetry and bond formation between the flattened faces in the squashed nanotubes.