I can only answer the question of why is it mostly iron. Not too sure of the magnetic properties of iron versus nickel.
As said in another answer, there is simply much more iron around than nickel. But the earth has also a large amount of other metals: silicon, magnesium, calcium, aluminium. So why is the core made of iron-nickel and not the other stuff? The answer is in the oxygen.
When you take a metal and oxygen, you form an oxide - usually a solid, brittle, "earthy" material. The best example is metallic iron + oxygen = rust. But not all metals are the same - some metals "like" oxygen more than others. If you have one atom of magnesium and another of iron, and only one atom of oxygen around - it will first bond with magnesium. Considering the entire oxygen budget of the Earth, there was enough oxygen to bond with all of the silicon, magnesium, calcium, aluminium (and just about the rest of the periodic table) to form the solids we usually refer to as rocks. By the time you got to the less oxygen-loving elements, such as nickel and iron, you had very little oxygen left. You had enough to oxidise some of the iron and nickel, but not all of it. That's why there was a lot of iron and nickel that was left as metals.
During Earth's formation, the entire thing was molten. Metallic iron and nickel are denser than the oxidised stuff ("rocks"), so it sank to the bottom, forming the metallic core. The oxidised metals ended up forming the mantle on top of it.