Airpods connect to iPhone perfectly but disconnect from MacBook after a few seconds
The fact that the Airpods connect to Bluetooth but never show up in Sound output/input devices indicate an issue with macOS system audio. Open a terminal and run:

sudo killall coreaudiod


Now try to connect the Airpods via Bluetooth. That should work. If not, try restarting the MacBook and connecting again.