connecting an iMac monitor to a Mac mini M1
How to connect a 2013 Catalina iMac monitor to a Mac mini M2?
How to connect a 2013 Catalina iMac monitor to a Mac mini M2?
Review the document: Use your iMac as a display with target display mode - Apple Support
Target display mode is a feature available with late 2009-Mid 2014 iMacs. The display Mac has to be running macOS High Sierra or older and the signal producing Mac has to be running macOS Catalina (ca. 2019) or earlier.
Your Mini is too new.
connecting an iMac monitor to a Mac mini M1