The pivot algorithm is a dynamic method for generating d-dimensional canonical ensembles by modifying chain dimensions through pivot moves in a Markov chain. It involves selecting a pivot point and rotating coordinates while checking for self-avoiding walks to determine accepted moves. Analysis includes calculating the scaling exponent through the square average radius of gyration for different dimensions.