While there are star trackers (devices you mount your camera to to follow the movement of the stars) usually you have a steady camera and then align the images in post-processing with a program like Sequator, StarStax or Siril (other paid options also available).