Cagliari is a regional capital with a Pisan fortress town on a hill, a real city beach and a salt-pan park where flamingos live all year, all within a bus ride of each other. The Sardinians call it Casteddu, "the castle", and the name is a fair summary of its history. Pisa founded a fortified town on the limestone hill here in the early 1200s, Aragon and Spain ruled it from the 1320s, the Savoy dynasty took over in 1718, and the Allied bombing of February 1943 damaged around 80% of its buildings. Underneath all that sit a Phoenician-Punic port, the largest Punic necropolis still in existence and a Roman amphitheatre cut straight out of the rock.
It is a mid-sized city of about 146,000 people that locals use all day: the Poetto beach is eight kilometers of sand at the end of a bus line, and the salt pans next to it have flamingos in them all year. Five days works because the town needs two of them, the beach and the lagoon one more, and the best sand in the south sits an hour or so away at Chia, Tuerredda and Villasimius, which need a day each. Be realistic about the season: swimming is a June to early October plan, and from late October the beaches are for walking, with many beach bars and clubs shut and the sea cooling fast. Cagliari itself stays pleasant and busy all year, so this guide works in October and November too, just with the beach days swapped for coast walks. The beaches are also mostly a rental-car day: the buses reach Pula, Chia and Villasimius, but not Tuerredda or the Capo Carbonara coves.
The plan runs day by day. Day one is Castello and the museums, day two Bonaria, the market and the Roman and Punic remains, day three the flamingos and the Poetto, day four Nora, Chia and Tuerredda on the west coast and day five Villasimius on the east. Su Nuraxi di Barumini, the UNESCO nuraghe, and the Giants of Mont'e Prama are in the "more time" section, because both are a long drive and the Giants have moved since most guidebooks were printed. Start on a Tuesday if you can, so the botanical garden is open on day two and the buses behind the two day trips run on their weekday timetable. It's also a good first look at Italy's Sardinian side, though this plan stays in the south of the island.