What is a sundog, and how did “sundogs” get their name?

Why are "sundogs" called by that name?

Before answering the why question, let me answer a what question, namely, What is a sundog, or mock Sun, in the
first place? It’s a concentrated patch of sunlight occasionally
seen about 22° to the left or right of the Sun. Sundogs form,
often in pairs on either side of our daytime star, when sunlight
refracts through icy clouds containing hexagonal platecrystals aligned with their large, flat faces parallel to the ground. Technically known as parhelia, singular parhelion, they are often white but sometimes quite colorful, looking like detached pieces of rainbow, with red on the inside, toward the Sun, and blue on the outside.

There are several authoritative books and Web sites about atmospheric phenomena, but none of the ones I checked say anything about why parhelia are called sundogs. My guess is their authors are cat people. I’m a dog person, and whenever I’m at home, my pooch, Duncan, follows me around the house close at my heels — just as a parhelion dogs the Sun. While I can’t prove it, I’d wager the term “sundog” was coined by an observer with a dog.
The term has been in use since the early 1600s, so we’ll
probably never know its origin for certain.

— Richard Tresch Fienberg