Mercury goes around the Sun in 88 Earth days. It spins on its axis once every 58.6 days. Put those together and you get one of the oddest calendars in the Solar System: from one sunrise to the next takes about 176 Earth days, which is two full Mercury years. A day on Mercury is twice as long as its year.
Mercury's spin and orbit are locked in a 3:2 ratio. In the time it takes to circle the Sun twice (about 176 days), it rotates exactly three times (3 × 58.65 ≈ 176). That is not the Moon's 1:1 lock, where one face always points at us. Mercury's orbit is so stretched, with an eccentricity of about 0.21, that the 3:2 lock is the stable one. Its distance from the Sun swings from about 46 million km at closest approach to about 70 million km at the farthest.
The key idea is that a "day" is not one spin. A solar day is the time for the Sun to return to the same spot in the sky. Because the planet is also moving round the Sun, it has to turn a bit extra each time. On Mercury the extra turn is huge, so the day drags out to 176 days.
Below is Mercury seen from above. The orange flag is planted on the surface. Press play or drag the slider, and watch the three counters. A "noon" is counted every time the flag points straight at the Sun.
Mercury moves fastest near the Sun and slowest far away, so its orbital motion speeds up and slows down while its spin stays steady. Near closest approach the orbital motion briefly outpaces the spin. For a stretch of days, from the surface the Sun appears to stall, slide backwards across the sky, then stall again and carry on. Scrub the slider through days 70 to 100 in the model and watch the dashed line pointing at the Sun: relative to the flag it briefly slides the wrong way.
At certain spots on the surface this gives a double sunrise: the Sun rises, dips back below the horizon, then rises again for good. Sunset can do the same trick.
Before radar, astronomers believed Mercury kept one face to the Sun like the Moon does to Earth. Radar measurements in 1965 showed the true 59-day spin and overturned that belief. The 3:2 lock is a reminder that the simplest ratio is not always the one nature picks: with a stretched orbit, a three-for-two lock holds steady.