user17301: 
I often see something like the above when playing chess online. When I played Ruy Lopez and my opponent played Classical Variation, but I transposed us to Four Knights Game Spanish Variation, I had castled in between the Classical move and the transposition (Move 4).
It seems the reason the opening name says "5. O-O" because it one of the openings where the order of moves doesn't matter. But is this a bug in chess.com or intentional for the opening name to be mismatched with the move numbers?

user2258: The opening variation is decided based on the position reached and not on move order. 
The expression 5. 0-0 is just to indicate the variation and has nothing to do with what you played. For example, imagine that for the Ruy Lopez, it showed the move after 3 moves. So when you play 1.e4 e5 2. Nf3 Nc6 3. Bb5, it would say "Ruy Lopez, 3. Bb5" because that entire expression is already stored. So it cannot happen that  after 1.e4 Nc6 2.Bb5 e5 3. Nf3, it would say "Ruy Lopez, 3. Nf3" or "Ruy Lopez, 2. Bb5". It doesn't mean that you played Bb5 on move 3.

user21223: I think this is intentional. The opening name alludes to the position reached, not the route taken to get there. The principal move order to reach this position is to start with the classical variation of the Spanish variation of the four knights game and play 5. O-O. 
It wouldn't make sense to say Four Knights Game: Spanish Variation, Classical Variation, 4. O-O because if you had reached it from that route then you wouldn't have castled on move 4. While it would make sense to describe it as a Ruy Lopez with 4. O-O, it would be undesirable to list the same position under two different openings.

17301: <p><a href="https://i.stack.imgur.com/ObJlU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ObJlU.png" alt="Opening name and notation seemingly mismatched"></a></p>

<p>I often see something like the above when playing chess online. When I played Ruy Lopez and my opponent played Classical Variation, but I transposed us to Four Knights Game Spanish Variation, I had castled in between the Classical move and the transposition (Move 4).</p>

<p>It seems the reason the opening name says "5. O-O" because it one of the openings where the order of moves doesn't matter. But is this a bug in chess.com or intentional for the opening name to be mismatched with the move numbers?</p>
 2258: <p>The opening variation is decided based on the position reached and not on move order. 
The expression 5. 0-0 is just to indicate the variation and has nothing to do with what you played. For example, imagine that for the Ruy Lopez, it showed the move after 3 moves. So when you play 1.e4 e5 2. Nf3 Nc6 3. Bb5, it would say "Ruy Lopez, 3. Bb5" because that entire expression is already stored. So it cannot happen that  after 1.e4 Nc6 2.Bb5 e5 3. Nf3, it would say "Ruy Lopez, 3. Nf3" or "Ruy Lopez, 2. Bb5". It doesn't mean that you played Bb5 on move 3.</p>
 21223: <p>I think this is intentional. The opening name alludes to the position reached, not the route taken to get there. The principal move order to reach this position is to start with the classical variation of the Spanish variation of the four knights game and play 5. O-O. </p>

<p>It wouldn't make sense to say <code>Four Knights Game: Spanish Variation, Classical Variation, 4. O-O</code> because if you had reached it from that route then you wouldn't have castled on move 4. While it would make sense to describe it as a Ruy Lopez with 4. O-O, it would be undesirable to list the same position under two different openings.</p>
