Why is a transistor used as a switch?
A transistor doesn't have any mechanical parts to wear out, so it will last longer. A transistor can switch much faster than a mechanical device, so they can switch all the way from DC up into the microwave region. It is physically small. Very handy. It allows a relatively small controlling current to switch very large controlled currents.