A magnet loses its magnetic properties when subjected to heat, the Earth's core is also hot but still it has magnetic properties, Why?
The magnets that you learned about in junior high are fundamentally different from the ionic liquid that generates the Earth's magnetic field.
Conventional magnets get their magnetism from having a large number of magnetic "domains" aligned in the same direction within the (solid) material. These domains are essentially large regions where the crystal structure is pointing in a certain direction, meaning the individual magnetic moments from the electrons and atoms are also pointing in a certain direction. An unmagnetized piece of iron will have its domains pointing in random directions, so their magnetic fields essentially cancel out; a magnetized piece of iron has its domains aligned, so their magnetic fields add together.
Changing which way a domain is pointing requires energy, which can be provided in a few different ways (greatly simplified here). This energy can be provided via, for example, mechanical force, which is why dropping a magnet or hitting it with a hammer tends to demagnetize it somewhat. There are also thermal fluctuations in a magnet, which, below the Curie temperature, are usually not energetic enough to change the domain orientation. This changes with the application of an external magnetic field, which raises the energy difference between domains pointing in different directions enough that a domain spontaneously changes direction due to normal thermal fluctuations. This is why a piece of iron can retain permanent magnetism after being exposed to an external field. Above the Curie temperature, the thermal fluctuations in the magnet are energetic enough to change the domain orientation. At this temperature, the domain orientation fluctuates randomly, demagnetizing the solid.
In contrast, the Earth's magnetic field is thought to be generated by an ionic liquid in the Earth's outer core. This liquid consists of moving positive and negative charges. Moving charges generate a magnetic field, and it is thought that currents in this liquid generate the magnetic field of the Earth. This is still very much an area of active research, as the complete dynamics of such fluids are extremely complex.
To summarize, the solid magnets you learned about in junior high get their magnetism from alignment of magnetic dipoles. The Earth gets its magnetic field from the movement of charges.
The Earth's magnetic field does not arise due to the same effect as the magnetic field of a permanent magnet. A permanent magnet's magnetic field is basically arose because at some point in that magnet's past it's internal magnetic dipoles (from its constituent atoms) were all aligned (it was magnetized) and then the alignment of its internal magnetic dipoles were "frozen" in place so to speak. So a permanent magnet's magnetic field is basically a "residual field". If you heat a permanent magnet up past its Currie temperature, the magnetic dipoles get enough energy to stop being aligned and the material will lose its magnetization. The Earth's magnetic field comes from moving electically conducting fluid in its core, via the so called "dynamo effect", see here. Basically, the macroscopic movement, convection, etc. of the Earth's core gives rise to a magnetic field. The magnetic field is being produced by motion, and is not a residual one that cares about a Curie temperature.
One caveat: the dynamo theory of magnetic fields in astrophysical bodies is the current best theory we have, but afaik, it's not fully well understood in all of its details yet. Magnetic fields in celestial bodies (including Earth) is a difficult problem to solve.
Because the Earth is an electro-magnet, not a permanent magnet.
There are two types of magnets: permanent magnets and electro-magnets.
Permanent magnets do tend to lose their magnetic qualities when they melt. electromagnets do not.
The Earth's magnetic field is (In Theory) formed by electric current flowing through various layers of its core. Part of the mechanism creating it is actually extreme heat.
This is because the magnetic field inside the earth is created by the circulating movement of its molten (mostly iron) core. That circulation pattern is set up by heat-driven convection, where the heat source in the core is from the radioactive decay of uranium in it.
Why is this the accepted answer? Here is the reasoning behind this: To begin with, we cannot directly explore that part of the earth's interior by drilling. But the acoustic properties of the earth's core have been extensively studied by measuring the transmission of earthquakes through it, which establishes the extent of the liquid core.
The fact that the core is mostly iron is established by measurements taken on asteroids which are representative of the stuff the earth was originally formed from. the fact that the iron is concentrated down there is a consequence of the fact that the earth started out in a molten state and therefore fractionated into a state where the dense stuff settled to the inner core and the lighter stuff rose up to form the outer crust.
Temperature gradient measurements of the crust let us estimate the rate of heat generation in the core and knowing how much uranium there is on average in the earth's crust lets us estimate how much there is in the core. The estimates of uranium content in the core and its known decay rate furnish a satisfactory check on the measured heat flux out of the core.
Those calculations let us estimate the temperature of the core. Since liquid iron expands when heated, we then know its density relative to the cooler regions farther out from the core and knowing its probable viscosity and how strong gravity is we can then establish that convective heat transport will be occurring there. Since the flowing iron is a good electrical conductor and we know what the rate of convective movement has to be in order to get the measured heat transfer rate right, we can then estimate the size of the resulting dynamo effect
that generates the known strength of magnetic field.
Within all the known error bounds for each step in the analysis, it fits together within reason. This is a hard problem for which only approximations are available. The exact details will probably forever remain hidden in the depths...