For latest Next.js developers, please check if you have another file named favicon.ico in your public folder. If you do, removing it can solve this issue.
Hekmat's answer works for some scenarios but not for me. Before I rename the favicon.ico to icon.ico, I got this:

Although we don't have 500 error now but we also don't have the 200 log, which means Next.js doesn't request for the favicon.ico, not request it successfully.
And I am using Next.js 15 so I re-check my public folder, actually I copied another favicon.ico into the public folder by mistake, and that's the reason why I am receiving the 500 error.
After removing the favicon.ico in public folder without rename the app/favicon.ico to app/icon.ico:
