I recently installed an app to manually activate the fans on my MacBook Pro M1 Pro as I've never been able to trigger them over the past 4+ years. Just to check whether the fans even work (they do).
I get them going full blast in 2 minutes from cities skylines.
You could also build Chromium from source. It makes my M1 Max's fans sing.
You must be using only lame languages like C or Go or Python that aren’t optimized for laptop warming during compilation. Try using a Real Language with a Real Compiler, like C++ or Rust or Swift, and build decent-sized projects using all cores.
(All joking aside, this is why I have a MacBook Pro. Compilation easily hits the Air’s thermal limits and the performance boost on the Pro with its fan is impressive.)