How come there is a zodiac sign for each 40 days?

It's closer to every 30 days. One per month.

It probably started off even with the start of the month, but the idea of the zodiac is some 2000 years old. Originally the idea was that the zodiac sign was the sun sign: which constellation the sun appeared to be in for that given period of time.

Trouble is that the Earth precesses (wobbles) on it's axis (over some 25000 years the north pole moves) so the sun isn't in the "proper" sign any more.

Changes to the calender have also occurred (which is why the change of sign occurs near the 21 of the month). Note that September, October, November, and December translate to the 7th, 8th, ninth, and tenth month ... which they ain't.