Why is transmitting a file locally through AirDroid slower than downloading it from the internet?
If I connect both the phone and the desktop to a WiFi router, I only get roughly half that speed.


This is because of the way a Wifi network works. If you transmit data from one Wifi device to a second Wifi device connected to the same Wifi network (using the Wifi frequency and the router does not support MIMO) the data will be always transmitted this way (defined by the Wifi standard):

device 1 -> Wifi router -> device 2

Therefore each packet has to be transmitted twice over the air and in your Wifi only one device can be active (sending or receiving data) at a time. 
It looks like the limiting factor in your set-up is the Wifi transmission speed. Both devices seem to use the same Wifi frequencies and therefore can not communicate at the same time but alternating. Therefore you only get the half speed.

This situation would not occur if your Wifi would support one of the following techniques:


The Wifi works in both 2.4GHz and 5GHz mode (and one device supports 5GHz Wifi)
The router has multiple antennas and can use antenna diversity (MU-MIMO) so that multiple devices can communicate at the same time


Alternatively there would be the possibility to use a WiFi Direct connection. It does not involve the router, therefore the connection should be up to twice as fast. But I don't have any experience with such a connection and AirDroid.