Why am I taught theory that I have no idea how to apply in practice?
I cannot vouch for CS, but in my field (physics) learning the theory is useful in order to construct yourself a starting basis for your future studies and research. 

You can still do valuable work without knowing much theory in my field. For example, the lab technicians, in general, don't know much theory, but can still perform a measurement. To obtain an X-ray spectrum for a sample, you put in on the holder, and you tell the computer to shine the X-rays. Then you get the spectrum. You take the spectrum, you load it into the program that compares it with the computer spectrum and see if the crystal that the chemists synthesized indeed has that structure. 

But, doing research is more complex that just performing a measurement. You have to be able to invent new things and to not miss something new that someone in your lab just discovered. Supposed one of your graduate students or the lab technician comes to you with some new data they say it "looks weird". Based on what you know from your research experience and from your theory background, you should be able to decide if they should do the measurement again, because the result violates some conservation laws you learned as an undergraduate, or because it really looks like they are onto something new.

As a computer scientist, you may not need all the theory you learn. It wasn't my case as a physicist. I needed more theory than I learned and I'm still learning some. Depending on what level you work, you would need more, or less theory. If you just want to develop code in a company, you won't need that much. Where I live, people become programmers by just attending boot camps. But, if you want to develop cutting edge stuff, you knowledge base has to be broad. You have to come up fast with ideas like the fast inverse square root. Without a serious theoretical background, it's doubtful you would come up with such things.