They made a first quality electric car that both solved the range problem and was sexy enough to attract a wide enough audience, thus for the first time making electric cars a viable and desirable alternative to ICE cars. The subsidies followed.
Federal subsidies in the US started in 2008, while the Model S wasn’t released until 2012.
Governments have heavily subsidized combustion engine car makers.