In this work, we conduct a study regarding the thermodynamic evolution and the phase transition of a black hole in a finite spherical cavity subject to the generalized uncertainty principle. The results demonstrate that both the positive and negative generalized uncertainty principle parameters β0 can significantly affect the thermodynamic quantities, stability, critical behavior, and phase transition of the black hole. For β0 > 0, the black hole forms a remnant with finite temperature, finite mass, and zero local heat capacity in the last stages of evolution, which can be regarded as an elementary particle. Meanwhile, it undergoes one second-order phase transition and two Hawking-Page-type phase transitions. The Gross-Perry-Yaffe phase transition occurs for both large black hole configuration and small black hole configuration. For β0 < 0, the Gross-Perry-Yaffe phase transition occurs only for large black hole configuration, and the temperature and heat capacity of the black hole remnant is finite, whereas its mass is zero. This indicates the remnant is metastable and would be in the Hawking-Page-type phase transition forever. Specifically, according to the viewpoint of corpuscular gravity, the remnant can be interpreted as an additional metastable tiny black hole configuration, which never appears in the original case and the positive correction case.