Praise be to Allah.
With regard to the share of the profits that the company pays at the end of every year, that is part of the employee’s wages and salary.
Because this money is paid and deposited in an account allocated to the employee, it is regarded as belonging to him, and preventing him from disposing of it during his period of employment, until he retires, makes his ownership of it incomplete, but it does not mean that it is not in fact his property.
The fact that the company deposits it in a riba-based account is pure wrongdoing, because they are ignoring his right (to choose what to do with it) by depositing it in a haraam type of account. Even if we assume that preventing him from disposing of it is something to which he gave consent when he signed his employment contract, that does not make it permissible for them under any circumstances to deposit it in a riba-based account.
After receiving this money, the employee must cleanse it of that [riba], even if he did not agree to it, because it resulted from his wealth. So he should give the extra amount that resulted from interest to charitable causes by way of getting rid of haraam wealth, and he should not leave it for them [the company].
See the answer to question no. 174697.
If it is a matter of choosing between letting this wealth grow by means of pure riba or investing it in matters that are mixed with haraam, then undoubtedly the latter is less grievous than the former. When he receives it, he should get rid of the haraam portion of it; he should try to work that out to the best of his ability.
And Allah knows best.