But that brings us to the reason 1. ... O-O is bad. First, Black's king is perfectly safe in the blocked center, which is nigh impossible to break through to. In fact, he'd be in a lot more danger on the kingside, where White has a massive space advantage and a ready-made attack.
Second, Black doesn't need to worry that much about king safety because he can exploit the weakness of White's d-pawn to seize the initiative very quickly with 1. ... Nc6. Now White loses material: 2. Rd1 Nb4 3. Qd2 Nc2 4. Rc1 O-O! wins the rook on a1, since 5. Rxc2 Rxc2 6. Qxc2 Qxd4+ forks king and rook on that same weak d4-square. Or White can opt, after 1. ... Nc6, for 2. Rc1 O-O!.
Now and not earlier is the time for castling. Earlier castling made no sense because it made the king much less safe and allowed White to consolidate his position; now, it completes Black's development and renews the threat to the d-pawn. After 3. Rd1 Nb4 Black wins similarly to the above, so the d-pawn drops off. Note here that Black's king is also safer because White has diverted half of his attacking force (i.e., the king's rook) to the queenside, where it's forced to play a purely defensive role in protecting the d-pawn.
So, like in a lot of Quora questions, the move isn't bad, really (since in this particular case White's attacking task is harder than it seems). It's just far inferior to another move, namely 1. ... Nc6.
One of Black's main problems in this e5 chain that almost certainly came from a French Defense is a cramping that prevents him from posting his best defensive piece, the king's knight, on its best and most active defensive square, f6. White's mating attack comes easily and naturally with either an advance of the f-pawn or a rook lift to the third rank, both of which he can accomplish in two moves here. Given some free moves she will play Rf1-f3-h3 or f4-f5-f6 and mate Black.
That said, he doesn't actually have free moves because of his lag in development, which translates into a weakness of his d4 pawn. If White immediately goes for the jugular after 1. ... O-O 2. Rf3? he loses it and has no time to start his attack, since 2. ... Nc6 wins the pawn. After 1. ... O-O White's best try is probably to overprotect d4 with Nb1-c3-e2 and Ra1-d1 before launching his attack. Still, the weakness of d4 majorly hampers White's ability to start his attack in the first place.