Chefchaouen is a small mountain town that happens to be painted blue. It was founded in 1471 as a fortress against the Portuguese, grew with Muslim and Jewish refugees from Spain, and sat in the Spanish zone until 1956. The name means roughly look at the horns, after the two peaks above it. Nobody can tell you for sure why the walls are blue, and the first stop sorts the stories from the facts.
Three days is the right length. The medina is small and you can walk all of it in a morning, so the pleasure is in slowing down: a hammam, a sunset on the hill, tea above a spring. The third day goes to the mountains, the Akchour waterfalls and God's Bridge in Talassemtane National Park. Two days would squeeze out the hike, and a fourth only suits walkers.
The plan goes day by day: the medina and the kasbah, then the spring and the Spanish Mosque, then the valley of Akchour. In winter it is cool and wet, so read the weather notes in the essentials and tips. Start on a Monday: Akchour then falls on a Wednesday, away from weekend day-trippers. More on the country at /countries/morocco. Most people arrive from 3 Days in Fes by CTM bus, and the trip fits a longer route that ends in 5 Days in Marrakech.