Castling is trick done by king & rook in chess. No other piece can do this.
Some rules:
1)King & rook should be at original position.
2)No pieces should between king & rook.
3)King should not have check.
4)King should not pass enemy attack square while castling.