Does this means
on the way back to company or
start from company, and back to some where else ?
And also why use
帰り, what does that mean?
Aの帰り means "on a way to my home from A", because 帰る not only means go back, but usually also mean go back to your home. 会社の帰りに本屋を寄るのが楽しみです means "I enjoy dropping by a bookstore on the way to go back my home from the company."
The equivalent word of に in English is "at". You use に in this case because you drop by a bookstore "at" the moment you are going back to your home.
会社の帰りに usually means 会社から帰る時に, or 'on the way home (from the company)'.
帰り here is a noun meaning
the way back or
return, while 行【い】き means the opposite.
To read a book on the way to and from school