Why did this commercial flight fly in circles while far from the destination? I was on the flight CX635 from Hong Kong to Singapore today, and I noticed the plane turning in a circle reminiscent of the holding pattern that planes often enter when they are queuing up to land. 

However, this time I saw this flight pattern on the in-flight tracker while it was still in level flight, and once again when it was descending. When I got home, I saw that the pattern was also recorded on FlightRadar24. 



Why did the pilot fly two circles in the middle of the ocean off the east coast of West Malaysia? I did not observe any obvious severe weather patterns, and the clouds were generally sparse (2 oktas or so) when it was doing the first roundabout, and there were no visible indicators of significant severe weather activity.
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.