Using molecular dynamics method, the progress of bonding single-wall carbon nanotubes and metal electrodes by ultrasonic nanowelding technique is described completely at atomistic length scales. The temperature distribution in electrodes is analyzed. The maximal temperature of electrode atoms is about 570.1K. The mechanism responsible for ultrasonic nanowelding is revealed as the result of the high-frequency ultrasonic energy softening the metal and causing plastic deformation of the metal under the clamping stress because of the ‘acoustic softening effect’. The ultrasonic parameter is optimized, which is important in improving the performance of carbon nanotube field-effect transistors and building reliable nanodevices.