ismu,
When you heat or hit a magnet, you give the atoms in the magnet energy, which allows them to flip around so that their spins are no longer aligned with each other. Although the individual atoms still act as little magnets, all the little magnets now point in different directions, meaning the big object is no longer a magnet overall.