If Edinburgh has one place that looks the way you pictured it before you arrived, this is it: the ridge of tenements and spires running from Edinburgh Castle down to the Palace of Holyroodhouse along the Royal Mile. This is the medieval city, closes and wynds peeling off the spine like ribs, the Grassmarket and Victoria Street tucked into the valley below the Castle rock, and the Cowgate running underneath it all in a bridge-covered canyon. It's compact enough to cover on foot in half a day and dense enough with history, crowds and genuinely good food and drink that most visitors only ever see the surface of it. If you want to be in the middle of it overnight, the Old Town is one of the areas covered in our where to stay in Edinburgh guide.
The Old Town's shape comes from geography as much as history. Medieval Edinburgh was squeezed onto the narrow ridge below the Castle, so it built up instead of out, ten- and eleven-storey tenements among the tallest domestic buildings in the world before the 20th century, packed along a single spine with narrow closes dropping steeply away on either side. When the New Town drained the wealthy north of the city from the 1760s, the Old Town declined into slum housing, and whole streets and courts were sealed up and built over rather than demolished, which is why a 17th-century close like Mary King's still survives intact underground today. It became a UNESCO World Heritage Site alongside the New Town in 1995.
The honest advice for a first visit is to accept the Royal Mile itself will be busy and a little tacky in patches, and to plan around that rather than fight it. The real texture of the Old Town is one street back: down a close, into the Grassmarket, along Victoria Street, or into a bar that doesn't have a tour group queuing outside. Here are the Old Town places I'd build a day or evening around, roughly in the order you'd meet them walking down from the Castle, plus an honest note on what to skip. For a street-by-street walk of the Royal Mile itself, see our dedicated Royal Mile guide; for the Grassmarket and Victoria Street in depth, our Grassmarket guide covers that corner on its own.