The expression uses way in its literal sense of a path or route. Going away from that route takes extra time or trouble, which became an image for making a special effort.
Make a special effort
Examples
- Our host went out of her way to find a meal I could eat.
- You do not need to go out of your way for us.
- Why did they go out of their way to make the new student feel welcome?
- He always goes out of his way to explain the rules clearly.
- The shop went out of its way to replace the damaged gift before her birthday.
- I would not go out of my way to visit that restaurant again.