The “default” LTspice transistor is idealized. Real ones aren’t that good :)
Transistors are called “switches” but they are not literal switches like a toggle switch is – they are not mechanical contacts.
Perhaps inadvertently, you have set up the transistor as a common-base switch, and that has a chance of working acceptably – you just need some load, the output can’t float.
simulate this circuit – Schematic created using CircuitLab
The component values do depend on the parameters of the transistor, and have to be adjusted in practice. It's not the best way to implement a switch, but it certainly works well enough to be useful for something.
The general idea for common-base switches is having ample amplitude of base drive. Ideally, the base drive would be a current source.
Below are the input, output and control waveforms of the circuit above. The control waveform's amplitude is scaled down 50% to make it fit better in the plot.
The non-linear distortion is about 0.5%. The input, output and distortion residue waveforms are plotted below.