This whole rescue is a bit of an embarrassment for the US. If they can't find something that wants to be found what hope would they have from an adversary. The Co-founder and Chairman, Horizon Maritime Services said they had the best equipment in the world yesterday. Seems like a bunch of bs peddlers now.
Military subs, especially missile and attack ones tend to go at around 500m max depth (IIRC officially usually around half that*), they also are much larger (20-30x in length and about ten times as wide) and have all sorts of equipment on board, along with dozens/hundreds of crew all of which makes noise (they invest massively in trying to keep that down).
Even at just a couple of hundred meters there can be several layers of water at different temperature etc from memory, and each of those can affect how well sound travels, which means that it's much easier to find something if you're on the same layer as it (which is quite important in both underwater warfare and finding something).
At 4km down in a sub without any real active noise other than the occupants deliberately making an effort it's going to be several orders of magnitude harder to find than an actively moving sub with a screw and all sorts of things like air pumps, ballast being shifted, cooling etc, all operating in relatively shallow water.
Looking for anything in the ocean is hard unless you either know quite precisely where it is, it's very big, or it's doing something that makes it easier to find, like making a noise that is either loud enough to be heard from a distance or you're close enough to pick it out of the background, or unusual enough and obvious enough to pick out of other noise at the same sort of level.
I would imagine that even someone hammering something metal against the titanium bulkhead in that sub is not going to be making a great deal of noise compared to other sounds in the ocean, and it's not necessarily going to travel massive distances or be easy to pin point once they hear it due to the way that acoustics work (even in a relatively small room it can be oddly hard to locate an intermittent noise). Even when they hear something it's going to take time to actually narrow it down and likely require additional sonar sensors be placed before they can get a better idea of it's location (the initial search will be "wide", they're trying to find anything, but the sensors are likely too far apart to give a nice small "possible" location, so you deploy more sensors around the ones that have already picked up the strongest signal to help refine it).
Basically looking for a sub like the one that is missing is probably going to be much harder than a military sub, despite how much time and money navies put into making their subs hard to find, as navel subs have to work at being stealthy as they can't avoid their default state of not being stealthy (every bit of active equipment makes it harder, every cubic meter of size makes it harder), a submersible that is basically a largely inert, but small object is starting off as being stealthy.
*Making a sub that goes deeper can compromise it's operational abilities in other regards, as the deeper you go the harder it is to make a sub strong enough, especially when like a military sub you've got the need for all sorts of openings in the hull for everything from the propulsion, to missile/torpedo/crew hatches.