Let say you are Luxembourg, and the average tax is 30% of your profit in the EU. Luxembourg is roughly .1% of the EU population. Assuming an ideal world, a company would them make .1% of its profit in Luxembourg. Now, let say Luxembourg offers a deal with a company so that they can artificially put all the profit from its EU operations in Luxembourg: in order for the country to keep the same taxes, it would only need to have a tax rate of 0.03%. From the Luxembourg point of view, they have the same tax amount as before. And from the company perspective, they are now paying taxes as if they were only paying taxes in Luxembourg, which is peanuts for them.
Now, the current situation is not as caricatural as this scenario, but that is what is happening. The end result is just lower taxes created artificially (but legally). And the big problem is that it is not easy to fix while being in a EU context: the easiest solution would be to have common tax rates, though that would create some other issues. At the very least, closer tax rates would help the matter as moving your profit from one country to another is not free for the companies.