Because they specifically target bacteria or fungi.
Going just by the name: Antibiotics, as the name implies, are chemicals that eliminate biological or "living" micro-organisms. As we all know, viruses are not considered "living" micro-organisms. So like most biological terminologies, you can guess the function just from the name itself.
Going into more details, antibiotics in general are chemicals that target either the reproductive mechanisms of micro-organisms or mechanisms of homeostasis. Either killing the micro-organism or rendering it unable to divide/reproduce, hence stopping the infection from increasing and spreading.
The mechanism of action for antibiotics does not effect viruses, since they are extremely specific to a certain type of bacteria or fungi. Hence, making them useless and ineffective against viruses. This is a reason why some call viruses as "ghosts", since they are invisible to normal anti-infection solutions.
Unlike bacteria and fungi, viruses increase in number and spread by injecting its DNA or RNA into the host's cells (our bodies) and letting it "corrupt" or "trick" our cells into producing more virus particles/bodies and then releasing it into the surroundings to infect more cells and go through the same cycle.
So far, there are no actual drugs to eliminate viruses. However, our bodies will fight the virus on its own given a few days, depending on how strong the person's immune system is. This battle that occurs between our bodies and the infecting virus will exhaust your body and temporarily decrease its immunity to other infections, namely bacterial infections.
Some doctors give antibiotics to patients with viral infections to prevent the occurrence of secondary bacterial or fungal infections. NOT to cure the primary infection itself. However, this will cause a decrease in the body's immunity if done repeatedly since the body will develop reliance on the antibiotics instead of its own immune system.
I hope I cleared everything in your mind regarding this controversial matter.