The battery is dead.
The computer (in this case your MacBook Air) turns off because there is no more/not enough charge in the battery. If it's necessary to have the power adapter plugged in when trying to turn it on, it's a sure sign that the battery is discharged.
There are a number of utilities that you can get (paid and free) that will look at your battery status:
- Battery Health
These are all good, but in my opinion, I would much rather use built in tools to get this info.
Using Terminal, just issue the command:
$ system_profiler SPPowerDataType
That will give you all the power settings related to your Mac. The output can be rather lengthy; the info you need will be at the top. You can limit it to just the battery info by tweaking the command as follows:
$ system_profiler SPPowerDataType | grep -i "charge information" -A 10
Charge Information: Charge Remaining (mAh): 3433 Fully Charged: Yes Charging: No Full Charge Capacity (mAh): 3517 Health Information: Cycle Count: 941 Condition: Service Battery Battery Installed: Yes Amperage (mA): 0 Voltage (mV): 12343
Here we can see that the battery is in need of service. (Coincidentally, I have a MBP with the exact same symptoms you have, so the output here works perfectly!) The key here is that under "Amperage" we get a "0" which means there is literally no current coming from the battery (Note: even though it may have voltage, if there are no amps, it won't have the "power" to supply).
If we unplug the power adapter, the battery has nothing to supply so the computer shuts off.
You just need a new replacement battery battery (I suggest getting ones with at minimum a 12 month warranty; 18 month is better). From personal experience, the more "warranted" batteries lasted much longer. Definitely avoid the ones with less than a 12 month warranty no matter how inexpensive they are.
To replace the battery; it's actually very simple. Just remove the screws holding the back cover in place.
Then, just remove the screws holding in the battery and swap. Just be careful when disconnecting the battery from the logic board. Don't yank it off, use a spudger or similar tool to disconnect the molex connector by "wedging" it off.
Reverse the procedure to reassemble. Make sure you note where each screw comes from as they are different.
That's it. Your MBA will now be able to hold a charge like it did when new.