J.K. Rowling largely associated Edinburgh with writing the early Harry Potter books.
After returning to the United Kingdom from Portugal, Rowling settled in Edinburgh with her daughter. She wrote in several locations, including cafés, and continued developing the Harry Potter manuscript while living in Scotland. Edinburgh later became strongly associated with her public literary identity and with the development of the series.
A common oversimplification is that Rowling wrote every early chapter in one famous café. She did write at cafés, but the first novel was developed over a longer period and in multiple places. The city’s association with the books reflects both her residence and the visibility of her writing routine.
The Harry Potter stories themselves are not set primarily in Edinburgh. Hogwarts is fictional, and many locations in the novels are invented or composites. Edinburgh’s importance is biographical: it was the Scottish city where Rowling lived and wrote during the series’ formative period.