What is the purpose of castling in chess?
Castling is always an option - it is never forced upon a player. It is however a very commonly taken option as it:


places the king in an easily defended position
moves the rook towards the centre of the board where it is easily developed
and does all that in one move, improving the player's tempo