Caret is a word designator in bash's history scheme. Here it acts as a way to mark the thing with the thing being replaced. There's a more detailed explanation in [1] and a quick read in [2]. Essentially bash let's you do manipulation and re-execution of commands from your history and one of the manipulations is via word substitution.