Chess.com puzzles are often wrong


There is nothing illegal in today's puzzle. The castling rule you are thinking of is that the king can't castle through check. The king never castled through an attacked square.
The rook can pass through attacked squares; they can't be put in check.