Jaqen H'ghar from Game of Thrones is obviously a ninja-like fighter and has shown his incredible skills.
How did such a great fighter get caught and end up in the dungeons?
The short answer is, in the TV show, we absolutely don't know, and even in the books, it's mysterious. But there are a few small clues we can use to focus the possibilities. (this is based on the TV show - a couple of points from the books are mentioned in spoiler tags).
First, it appears that a master assassin is in the dungeons because a master spy chooses for him to be:
We see in Season 1 that Varys has no trouble sneaking into the cells, and seems pretty aware of what's going on in them. Varys casually mentions he could easily free Ned, but it's not in his interests to do so.
In season 4, we see that Varys wasn't boasting, and also that the dungeons are connected to a network of tunnels that connect to the docks and other useful places frequented by major characters (and Varys seems to know these tunnels). In the books it's explained that these secret tunnels are extensive.
The head jailer is Varys in disguise, and probably has been since Mad King Aerys - and also the official story of how Jaqen and the others were given to the Watch doesn't quite fit the order of events, it looks like someone (probably Varys) forged the papers with Ned's signature.
Varys essentially has the final say on who and what comes in and out of the black cells, and what happens while they're in there.
Second, an asker makes a great assumption. If a man is in a cell, does this mean a man must have been caught?
Perhaps a cell is a convenient place for a man to be?
This gives us four logical possibilities:
The "because Varys" explanations seem the simplest and the neatest fit with other events.
In the TV show, there are really no clues at all about why Jaqen was in Westeros or what his long term plan is (if he has one). It's not even clear if he's the same "man wearing Tom Wlaschiha's face" as the one Ayra meets in Season 5 (I suspect not). In the books, there's one pretty big clue, but it still leaves lots of mystery (this contains likely season 7 spoilers if you've not read AFFC):
A man exactly matching the description of the face Jaqen donned after leaving Ayra turns up in The Citadel in Old Town, tricks a foolish novice called Pate to give him a key giving him access to all areas, then kills the novice. Later, Sam meets a man who has assumed the novice's identity, who seems to have Pate's face but also seems much smarter than Pate was, who takes an active interest in Sam. It's widely assumed that this is Jaqen on some unknown mission.