I believe the way this happens is similar to what in the US is called a "Private Letter Ruling"
Basically a business or individual wants to know if a particular tax or other business strategy, basically a loophole, is legal. So they hire a specialty law firm and pay them to document the plan and then send it to the IRS or another regulator. What they get back is an opinion by that regulator that what they are doing is legal or not. Its not binding in court though but it might protect you from penalties or criminal charges for tax evasion if a court later disagrees with the private letter ruling since you followed the best legal advice and regulator interpretations in good faith.
So what seems to have happened here is Apple had this complex tax avoidance scheme and was able to convince Irish tax officials to sign off that their interpretation is that this is legal. However what was really happening is that Apple was telling all the other EU tax authorities that revenue was being earned in Ireland and would be taxed there. Then they were being allowed to tell Irish tax authorities that most of it was being earned and taxed elsewhere simultaneously.
Fundamentally this is a dishonest deal and the EU is right to require that a corporation when filing its taxes is not allowed to create two alternate stories to document its revenue and profits whereby a large portion of it, $100B+ of profits in this case is not being taxed anywhere.