What Causes the Earth Magnetic Field?

Cause of magnetic field of Earth is Dynamo Theory. It is a mechanism by which a celestial body such as planet gets a magnetic field and poles. Look here for more information: