Only 45 are active on game day, not all 53. See:
The other 8 are on the roster, but do not dress for games. This allows the team to sit players for injuries, matchups, etc., without any other teams being able to sign them. The practice squad players (another 8 on top of the 53 man roster) may be signed to another team's 53-man roster at any time.
Also, on gameday, the team may designate a player to be the "emergency quarterback", who does not count against the 45-man limit. The catch here is that if this player is put into the game at any time, then the starting QB is not allowed to return to the game.