Life insurance is a kind of commercial insurance, which is haraam, because it involves uncertainty, riba and gambling, and consuming wealth unlawfully. It is not permissible to work in commercial insurance companies, because this is a kind of cooperating in sin, which Allaah has forbidden, as He says (interpretation of the meaning):
“Help you one another in Al-Birr and At-Taqwa (virtue, righteousness and piety); but do not help one another in sin and transgression. And fear Allaah. Verily, Allaah is Severe in punishment”
See also question no. 8889.
There is nothing wrong with your keeping the money that you earned from working in that company before you came to know that it is haraam, because Allaah says (interpretation of the meaning):
“So whosoever receives an admonition from his Lord and stops eating Ribaa, shall not be punished for the past; his case is for Allaah (to judge)”
With regard to the money that you took from the company after you came to know that it is haraam, then you have to get rid of it, because it is haraam wealth, so you can spend it on charitable causes.
See Fataawa al-Lajnah al-Daa’imah li’l-Buhooth al-‘Ilmiyyah wa’l-Ifta’, 15/8.
And Allaah knows best.