There have been a few reports of Macs running recent versions of macOS, particularly 12.0.1, gradually getting slower until they almost grind to a halt. This article suggests a structured way to tackle both diagnosing and dealing with this.
Before you bring your Mac back to life, if possible spare a couple of moments to record some vital clues as to what has gone wrong.
Apple does provide one way of capturing full details using
sysdiagnose, which is essential if you’re going to report the problem to its engineers. You invoke this by pressing the Shift-Control-Option-Command and . (period or full stop) keys together, after which the screen should flash once, then several minutes later a window opens showing where the diagnostic dump file has been saved, so you can carry on.
The snag is that, unless you are an Apple engineer and know your way around the log files and other data captured, this is of no value to you. It’s also easily captured using the command in Activity Monitor’s View menu.