@Paul clarified the behaviour of trim().
The solution you presented in the comment is potentially treacherous:
SELECT replace('509960405509960404','509960405','')
Replaces all occurrences of '509960405' not just the first. For example:
SELECT replace('509960405509960404','50996040' ,'');
Results in 54. I suspect that's not what you want.
Use a regular expressions with regexp_replace():
SELECT regexp_replace('509960405509960404','^509960405' ,'');
^ .. glues the pattern to the start of the string ("left-anchored").
regexp_replace() is more expensive than a simple replace() but also more versatile.