I've been reading about the difference between electromagnets and permanent magnets and I have a question about the difference between them. If permanent magnets get their magnetic field from the spin of their constituent electrons, isn't this spin still present in the case of electromagnets, since electrons everywhere have their own spin? So, does the difference then lie in the type of material being used, whether its hard or soft metal? Otherwise, electrons exist in both of them so we have electron spin in both cases. What I mean is that it's not reasonable to differentiate between them by the electron spin since both have it.
In a permanent magnet it is the electron spin that is responsible for magnetism. A simple explanation is that all of the spins are aligned. Going beyond this simple explanation requires at least some understanding of quantum mechanics; understanding permanent magnets in detail requires a deep understanding of quantum mechanics as well as an understanding of condensed matter physics and many body physics.
In an electromagnet the magnetic field is generated by moving electric charges. You can understand electromagnets using only Maxwell equations. There is no need to reference quantum mechanics to understand electromagnets. In contrast to permanent magnets the electron spins are not all aligned and the electron spin does not play an important role in magnetism. It is electron charge that is essential.