9 speed chain doesn't fit 9 speed cassette
Pretty simple - the new chain is too short. Maybe you bought a chain with too few links, maybe it's a production error. 

The pitch (distance between pin centers) of bicycle chain is 1/2", so it's easy to count links by measuring. 

Chain length required is determined by chainstay length and largest chainring and sprocket size. Usually you get a chain a few links too long and cut it to size and re-join. When replacing a chain you can use the old chain to size the new one. If the old chain is lost chain length can be determined by fitting to the bike. Park Tool has a good video on how to do that.