To be fair, most ships don’t have this problem. It’s related to the ballistics, like you said, but you can figure this out pretty easily by checking the muzzle velocity of the shell (it’s not a perfectly accurate way to determine the ballistics, but it’s accurate enough).
For example, the Nurnberg light cruiser doesn’t have this problem, because its mains and secondaries fly at about the same speed, so they will hit the target area at about the same time:
Spoiler
But almost identical ship, the Karlsruhe light cruiser has this problem. It uses the same main guns, but different secondaries, which has much lower shell speed:
Spoiler
So it will take longer for the secondaries to reach the target area, so if you or your target moves, your mains and secondaries won’t land at the same place.
The interesting part is, on some ships you can actually affect this, by switching the ammo. Mentioned Karlsruhe can also use this shell for main guns with lower muzzle velocity:
Spoiler
It’s still not ideal, because this shell is still much faster than 785 m/s, but if you use this shell, mains and secondaries will at least land much closer to each other.
Judging from your screenshot, you are using the USS Northampton, so you are dealing with the problem mentioned above:
Spoiler
Unfortunately, you can do nothing about it. When I played this ship (and other similar ships), I used to correct my aim when firing with secondaries (main guns have very long reload speed, so you can do that). For example, if I was standing still and the target was moving right, after shooting mains, I just moved my mouse cursor more to the right, and just before mains reloaded I moved my mouse cursor back to the previous position. This is a bit tedious, but that’s the only way to use these secondaries effectively.
The good news is, so big main/secondary guns shells velocity difference is very rare. From what I remember, the USS Portland / USS Northampton (and a few more similar ships) are the worst case scenario in the whole game. So it’s not as big a problem as it might seem.
This is actually a feature. Apart from a few ships (that have almost instant secondaries reload time), if your main and secondary guns are not reloading, when you press left mouse button once and hold it, only the mains will fire. If you want to fire with both, you have to pretty much double-click (or just left click again, when your mains are reloading).
They designed the system like this, so you can fire only mains if you want to. It works pretty well, but there are ships with almost instant reload rate on secondary guns, and the system is bugged and doesn’t work correctly there (for example, the USS Wilkinson and the HMS Tiger are affected by this problem).