As with aircraft using the clock system to indicate targets etc regardless of which direction the aircraft is flying, a sub or ship use the same idea except much more accurately.
So while an aircraft can be flying along a course of 315 degrees (relative to north which is 360 or 0 degrees) a crew member when yelling "bandit! 3 o'clock level" still indicates the target is 90 degrees to the right
of the aircraft. The nose of the aircraft always points to 12 o'clock regardless of which direction it's travelling.
It's the same for ships/subs except they don't use the clock system, they use a 360 compass heading but still using the ship as the center and the bow always pointing to zero degrees so to speak. The confusion lies for some people in the fact that both the course and bearings use a similar reference (degrees). So to use the above example of the aircraft:
The sub/ship is zipping along on a heading of 315 degrees (relative to north). A crew member yells out, "ship spotted, 090 degrees!". The crew instinctively look 90 degrees to the right of the centerline of the boat.
Not sure if that helps or causes more confusion, LOL.

Having said all that I know that the sea dogs among us can explain expressions like "sail sighted, two points off the starboard bow" or "abaft" etc as that's also a similar "clock" method for sailors but in their own jargon.