This is because they followed what angered God and hated the things that please Him. Consequently, He has nullified their works.
ذٰلِكَ بِأَنَّهُمُ اتَّبَعوا ما أَسخَطَ اللَّهَ وَكَرِهوا رِضوٰنَهُ فَأَحبَطَ أَعمٰلَهُم
zaalika bi annahumut taba’oo maaa askhatal laaha wa karihoo ridwaanahoo fa ahbata a’maalahum