Per rules of castling, the king cannot move prior to castling.
I recommend checking out this official article: https://www.chess.com/terms/castling-chess
"The first [rule of castling] is that you may only castle if you haven't moved your king and your rook (on the side where you want to castle)."
https://www.chess.com/game/live/46825763055