You can't compare the energy storage density in isolation. Engines are heavy...Model S's motor generates 362 horsepower (according to the official specs), and only weighs 70 pounds...the equivalent ICE would be 500+ :-)
(Yes, the inverter weighs something, but the transmission is much simpler as well for electric...overall you save a few hundred pounds easily...A Model 3 battery pack is between 600 and 1000 pounds--so pretty close to the crossover point.)