The EU can only pass legislation for those areas where it has been conferred authority by the Member States. In the case of taxation, unanimity was made a condition for that authority in Art 113 TFEU:
The Council shall, acting unanimously in accordance with a special legislative procedure and after consulting the European Parliament and the Economic and Social Committee, adopt provisions for the harmonisation of legislation concerning turnover taxes, excise duties and other forms of indirect taxation to the extent that such harmonisation is necessary to ensure the establishment and the functioning of the internal market and to avoid distortion of competition.
Note also that this authority is limited to certain kinds of taxes, in particular to harmonizing the European VAT system.
To be distinguished from tax laws affecting the Single Market, taxation of Member States (membership dues) also requires unanimity per Art 223 TFEU.
Aside from that, and aside from special rules to protect EU institutions and officials from inappropriate taxation, the EU has not been given authority over tax matters. In particular, there is currently no basis e.g. for an EU-wide income tax. Instead, the TFEU reaffirms Member State's rights to pass their own tax laws, as long as these laws don't interfere with tax laws of other Member States.