The Spanish apañar (“to fix, to rig”, as in “to fix the jury”) comes from the Latin pannus, which meant “cloth, garment or rag.” How did this transformation happen, as Latin turned into Spanish? Well, you use a cloth to tie people, which is one way of applying pressure — physically and metaphorically.
From the same Latin root pannus, we get the English… pane. As in a window pane. Here, the metaphorical meeting of the cloth or clothing took on the meaning of a divider — which divides one section from the other. Which is precisely the opposite meaning of the Spanish!
You can see the p-n root in both. And it’s always noteworthy that the Latin double n –nn– consistently transformed into the ñ in Spanish.