Why did this commercial flight fly in circles while far from the destination?
The first "circle" is a holding pattern. We discussed those here.
In particular, it seems that you were on hold at VINIL or VEPLI, according to the approach charts (page 5 of the PDF).

The second one is most likely for separation on final approach, the aircraft was probably early and ATC has asked them to perform a 360° to increase the separation between them and the aircraft in front.