Ha. It's the most likely answer, of course. But I'm so sure I've never been arrested in Anvil. In fact, I haven't spent a great deal of time there at all, despite my 70+ hours of game time so far.
Its possible - and extremely annoying - that you were arrested on the road or an inn somewhere, and taken to the Anvil prison, even if you were nowhere near Anvil.
I was on the green road just north of Leyawiin once, got arrested, and was taken to the Cheydinhal castle.