Which clothes are you punished for in the cities of Skyrim? [duplicate]
Solution 1:
You can wear any armor in any city without repercussions in unmodded Skyrim. Hold guards will comment if you wear the armor of the opposing faction, but will not place a bounty on your character.
At worst, guards will say something along the lines of "You dare strut around here, wearing that filthy Stormcloak hide?" or "For your sake, I hope you took that armor from a dead Imperial scout..."
You'll get similarly snarky comments if you wear Thieves Guild armor or are a member of the Dark Brotherhood. Still, the game is very forgiving and you will never be punished for wearing a specific faction's gear.
You can read the comments that hold guards say about your equipment by following this link
In your case you may have been seen stealing something, trespassing, or committing another minor crime which caused the guard to investigate you. In fact, you may have been witnessed breaking the law days earlier and only just now came close enough to a guard to be accosted by them