That is because they followed what angered Allah and disliked [what earns] His pleasure, so He rendered worthless their deeds.
The Saheeh International Quran Translation
ذَٰلِكَ بِأَنَّهُمُ ٱتَّبَعُوا۟ مَآ أَسْخَطَ ٱللَّهَ وَكَرِهُوا۟ رِضْوَٰنَهُۥ فَأَحْبَطَ أَعْمَٰلَهُمْThat is because they followed what angered Allah and disliked [what earns] His pleasure, so He rendered worthless their deeds.