Hi,
Is the URL in the "canonical URL" field of your product/category the one used ?
If so, and if the URL is wrong, it means that you have the wrong one in the "canonical URL" field of your product/category.
As I said previously, you need to enter the URL that you want for your product/category in the "canonical URL" field of the product/category and that must be one of the valid URLs of the product/category.
If not, then the issue is with the listing which should use it instead of using another one and that can usually be explained because of caching or view overrides as I previously said. If you don't have a canonical URL in the product/category, and that the URL of the product/category on the listing doesn't work, then I don't see any other possibility than a caching or view override issue.
We can have a look to the backend, but the solution will be among what I said already. I don't see any other reason for what you describe to happen.