if votes are given to states not people then why are the amount of votes a state gets based on its population?
They're only based on population after a certain cutoff; That is, every state gets three votes automatically before the rest are given according to population.
This is why Big states are penalized to a certain point in the Electoral college. As mentioned in the CGP grey video, California is ten votes short of what it would get if votes were allocated strictly based on population.
This means that if a state has less than the 1.5 million or so people in it that three votes gives after the cutoff, that states voting power can be doubled or tripled.
For example; Wyoming, the smallest state in terms of population, has three times the voting power it would have if votes were given votes strictly based on population. Meanwhile, California, the Biggest state in terms of population, gets ten less votes than it would otherwise get.