This name was likely given due to the squirrels' habit of holding their bushy tails high and waving them around as they move, making them appear to have a shadow following them.
The word has evolved through various languages over the centuries, finally arriving at "squirrel" in English.