No, Profit shifting is not illegal. It is a tax planning strategy used by multinational companies by using the loopholes in the taxation system. You can read about the Base Erosion and Profit Shifting (BEPS) – Issues, Measures taken by India in the given link.
- Taxation in India – Direct taxes, Indirect Taxes, Features of Taxation System
- Organisation for Economic Co-operation and Development [OECD] – Objectives, Member Countries, Responsibilities