So let me tell you a story about a Shepherd who lives in Magnesia, a city in Greece. His name was Megnes. Every day he used to herd his sheep through the plains and the mountains, with a metal stick in his hand.
So one day, a strange thing happened to him. While herding his sheep, he came across a rock that blocked the movement of his stick and his slippers got stuck, which has some iron nails in it. So on observing he found that the metal stick and the iron nails were attracted to the stone.
So, this is how the magnet was discovered and the magnet derives its name from the name of the shepherd itself.