Did you follow the steps mentioned in this article?
...
- Make sure that your iPhone, iPad, or Mac is updated to the latest version of iOS, iPadOS, or macOS, and that Bluetooth is on.
- Make sure that your AirPods are connected via Bluetooth to your iPhone, iPad, or Mac.
- Connect your iPhone, iPad, or Mac to Wi-Fi.
- Connect your charging case to power.
- Put your AirPods in their charging case and close the lid. Keep the lid of the charging case closed, and keep your AirPods in Bluetooth range of your iPhone, iPad, or Mac.
- Wait at least 30 minutes for the firmware to update.
- Open the lid of the charging case to reconnect your AirPods to your iPhone, iPad, or Mac.
- Check the firmware version again.
If you still can’t update your firmware, reset your AirPods, then try to update your firmware again.
...
copied from: About firmware updates for AirPods - Apple Support
Some users connected the AirPods to their iPhone, listened to music for a short time and put the AirPods back inside case, connecting them to the charger and placing them near the iPhone.