Why do magnets attract?

Because magnets can generate magnetic fields.

Magnets are composed of atoms such as iron, cobalt, nickel, etc. The internal structure of the atoms is quite special, and they have their own magnetic moments. Magnets can generate magnetic fields and attract ferromagnetic substances such as iron, nickel, cobalt and other metals.

magnets can be divided into "permanent magnets" and "non-permanent magnets". Permanent magnets can be natural products, also known as natural magnets, or they can be manufactured artificially. Non-permanent magnets, such as electromagnets, are magnetic only under certain conditions.

Extended information:

Physical action

refers to north and south; Attracting light and small objects; Electromagnets can be used as electromagnetic relays; Motor; Generator; Electroacoustics; Magnetic therapy; Magnetic levitation; Nuclear magnetic resonance.

magnetic field:

a magnetic field is a substance that has a magnetic effect on a magnet placed in it, which is called a magnetic field. The basic feature of a magnetic field is that it can exert a force on the moving charge in it, that is, the electrified conductor is subjected to the force of the magnetic field in the magnetic field.

this is the source of the magnetic field's force or distance to current and magnet. Modern theory shows that magnetic force is the relativistic effect of electric field force, and the region affected by magnetic force shows that the charge passing through the region or the magnetic pole placed in the region will be affected by mechanical force.

Baidu encyclopedia-magnet