Why is castling a bad move?

Kingside castling is a fine move in that position. After castling that way, the engine gives +1.78 with the advantage for white. With Kd2, the engine gives +2.18 with a smidge of an advantage more. Both moves are winning though, so I wouldn't say "castling to the right is a bad idea."
What I will say though is that the purpose of castling is usually to protect the King and develop the Rook out of the corner. In this case, "protect" from what? Most pieces have been exchanged off and there is little danger of checkmate. In the endgame, the King has more freedom to leave its shelter and it is a common idea to march the King activity towards the center of the board.
In this position, Kd2 decides the King is safe enough that it doesn't need to get castled. It is safe enough on d2 and because this is an endgame, it might be more active towards the center.