I live in CA but I work remotely for an IL dental office

I filed my taxes last year and did IL state as a nonres and I ended up oweing IL since it pulled what I paid them during the year to pay CA. I was under the impression that I would get a credit for IL ? I am currently making payments to IL state . What did I do wrong?