I tried all the fixes mentioned in other answers such as reset BT module, delete audio plugins in "/Library/Audio/Plug-Ins", PRAM reset. None of them worked for me.
What worked for me was deleting following .plist files related to bluetooth as mentioned in this link - https://iphonegeeks.com/bluetooth-not-working-on-mac-big-sur
com.apple.Bluetooth.plist file in /Library/Preferences directory
Files starting with com.apple.Bluetooth in ~/Library/Preferences/ByHost directory
After deleting above files I restarted my MacBook and I was able to connect to Airpods.
Note: Earlier I restored my MacBook using a Time Machine backup, perhaps that caused the issue by causing conflicting bluetooth settings and deleting the plist files fixed it. Not 100% sure, just my guess.