The link given by my ginger is helpful. It mentions the (now discontinued) iMic device by Griffin. I bought one about 15 years ago and still have it. You can use this to receive a signal from a mini-stereo plug and it passes it to a computer via USB.
On your Mac you will need to have software to receive and record the audio signal with iMic set as the input device. I used Sound Studio. The current version requires macOS 10.14 and will run on Monterey. I use this version with my Monterey System. However, it isn't cheap at around Au$80 / US$60 but it is an excellent audio recorder and editor. Alternatively, there are probably free or very cheap recording software you could find. I've seen recommendations for Audacity which is free and open-source but never used it myself.
You should also be able to use the pre-installed Apple software GarageBand to record and edit the audio too, though I've not used this in recent years for this purpose.
You can still get an iMic on ebay for not too much more than the retail cost when I bought mine - and I still use it to plug my guitar into my Mac for use with GarageBand.