NATO has Article 5.
The Parties agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all and consequently they agree that, if such an armed attack occurs, each of them, in exercise of the right of individual or collective self-defence recognised by Article 51 of the Charter of the United Nations, will assist the Party or Parties so attacked by taking forthwith, individually and in concert with the other Parties, such action as it deems necessary, including the use of armed force, to restore and maintain the security of the North Atlantic area.
The EU has Article 42.7.
If a Member State is the victim of armed aggression on its territory, the other Member States shall have towards it an obligation of aid and assistance by all the means in their power, in accordance with Article 51 of the United Nations Charter. This shall not prejudice the specific character of the security and defence policy of certain Member States.
Note the slightly stronger language ("all means in their power") for the EU, yet also the opt-out for the traditional neutrality of some EU member states.
The EU explicitly acknowledges the NATO membership of many EU members, especially those with larger armed forces.
Commitments and cooperation in this area shall be consistent with commitments under the North Atlantic Treaty Organisation, which, for those States which are members of it, remains the foundation of their collective defence and the forum for its implementation.
Basically the EU does not require members to substitute European military structures for the existing NATO structures. But as far as assistant commitments go, they both appear clear. Neither has been seriously tested in war. The 9/11 attacks were a very special case.
The difference is which countries have to come to their aid. EU, NATO, or both.