Yes; the NEC allows for installing a NEMA 14-50 receptacle on a 40A circuit (usually in cases where there is insufficient capacity for a 50A circuit.) If the condition of the existing wire is determined by the electrician to be good then the 14-50 receptacle can be used. The receptacle should be labeled 240V/40A so there is no confusion as to the maximum rating of the circuit.
A better option would be to install the Tesla Wall Connector on the side of the garage instead of the 14-50 receptacle. The Wall Connector is designed for use in all weather conditions. Even with a weather housing it is possible for water and moisture to get into the connection between the NEMA 14-50 receptacle and the 14-50 plug.
The Tesla Wall Connector now comes with a 24 ft charging cord so it might be able to reach the Tesla vehicle's charging port without having to back the Tesla vehicle onto the driveway. The Wall Connector can be set to operate on any circuit rated from 15A up to 60A so it could be set to 40A for use on the existing circuit.
For 2021 there is a federal tax credit that you could apply to the purchase and installation electric vehicle charging equipment of 30% of the cost up to a limit of $1000. More here:
About Form 8911, Alternative Fuel Vehicle Refueling Property Credit | Internal Revenue Service