State tax filing

i am asking about dividends and interest not wages. Why do i have to pay to PA  for dividends i earned when i did not reside in PA for entire year?