A MacBook Air shutting down when the battery still shows around 40%, then showing around 10% after you plug it in, is worth looking into.
The 100% Battery Health reading alone does not tell us why this is happening.
First, make sure macOS is fully up to date. Then go to System Settings >> Battery >> Battery Health and check that the condition says Normal, rather than looking only at the 100% capacity figure. Apple: Check battery health
Next, disconnect any USB-C hubs, external drives, displays, or other accessories and use the Mac on battery again.
Make a note of the battery percentage when it shuts down and see whether the same thing happens again.
Apple recommends disconnecting peripherals when investigating unexpected shutdowns. Apple: If your Mac restarted because of a problem
If it happens again, try Safe Mode. Shut down the Mac, hold the power button until Loading startup options appears, select your startup disk, hold Shift, and choose Continue in Safe Mode.
Then use the Mac normally for a while and see whether the shutdown occurs again.
If the problem continues, run Apple Diagnostics.
Shut down the Mac, hold the power button until the startup options appear, then hold Command (⌘)-D.
If a reference code appears, make a note of it. Apple: Use Apple Diagnostics to test your Mac
If the Mac keeps shutting down at roughly the same battery percentage, I too would also suggest having Apple Support or an Apple Authorized Service Provider take a look.
Have the computer evaluated by the Professionals who have the Special Hardware Software and Expertise to diagnose the issue and offer possible solutions
Make an Appointment at the Apple Genius Bar or call 1 800 MyApple and have them evaluate the computer
Other location Call Centres
Contact Apple for support and service