https://en.wikipedia.org/wiki/Tacking_(sailing)
Tacking is sometimes confused with beating to windward, which is a process of beating a course upwind and generally implies (but does not require) actually coming about. In the accompanying figure, the boat is seen to tack three times while beating to windward.
That is, beating windward is a process in which one moves towards the wind, but also has a sideways component to one's velocity. Tacking is the process by which one changes the direction of that sideways component, allowing one to have the sideways components cancel out and have a total movement that is directly into the wind. While in sailing, "tacking" refers specifically to the act of changing direction (a technique that is just one part of moving windward, and is used for movements other than moving windward), in general usage it tends to be used to refer to the entire process of moving windward, or, as in this example, metaphorically moving in a direction opposite to some prevailing tendency.