Your confusion might about negative work done might have arisen because the magnitude of a vector is always positive but as work done is a scalar quantity it can be either positive or negative.
You will be familiar with ordinary multiplication and perhaps were taught multiplication via a (real) number line which is drawn at the top of the diagram below.

On the number line you have positive numbers, negative numbers and zero.
Negative numbers are conceptually more difficult to deal with than positive numbers.
The meaning of $3$ oranges is "obvious" but the meaning of $-3$ oranges is perhaps less so.
$+3$ oranges might mean adding $3$ oranges to a box of oranges and $-2$ would then mean taking $2$ oranges from the box.
You could use this number line in the context of energy where $+3$ joules means adding $3$ joules of energy to a system and $-2$ joules means taking $2$ joules of energy from the system.
In the context of work done then $+3$ joules is the work done by a force and $-2$ joules is the work done on the force.
When you multiply you are really scaling so $3 \times 2$ means take the number $3$ and scale in by a factor $2$ ie double it.
It could also mean take the number $2$ and scale it by a factor $3$ ie triple it.
Either way to get the number $+6$.
From this you can build up the rule for multiplying numbers whose signs are the same (result is a positive number) and for multiplying numbers whose signs are different (result is a negative number).
The definition of work done comes from a multiplication (dot product) of two vectors force $\vec F$ and displacement $\vec S$.
In one dimension the multiplication is straight forward to apply.
If the force is $3$ newtons in a particular direct and the displacement is $2$ metres in the same direction gives the work done as $+6$ joule which is interpreted as the work done by the force.
However, if the force is $3$ newtons in a particular direct and the displacement is $2$ metres in the opposite direction this gives the work done as $-6$ joule which is interpreted as the work done on the force.
In vector notation this can be written as $3\hat x \cdot 2 \hat x = (3 \times 2) (\hat x \cdot \hat x) = 6$.
In which there is an ordinary multiplication (scaling) and a dot product, $\hat x \cdot \hat x= 1$
From the definition of work done a force in one direction and a displacement in the opposite direction will yield a negative value.
With $\vec F = 3 \hat x$ and $\vec S = -2 \hat x$ (the displacement has a component of $-2$ in the $\hat x$ direction) you get
$3\hat x \cdot 2 (-\hat x) = 3\hat x \cdot -2 (\hat x) =(3 \times -2) (\hat x \cdot \hat x) = -6$ and this is interpreted as the work done on the force.
The introduction of the dot product enables one to more easily multiply in dimensions greater than one.

Suppose that the force is $\vec F = F \hat f = 3 \hat x + 4\hat y$ where $\hat f = \frac 15 (3 \hat x + 5\hat y)$ and the displacement is $\vec S = S \hat s = 3 \hat x +-4\hat y$ where $\hat s = \frac 15 (3 \hat x +- 4\hat y)$
The work done by the force = $\vec F \cdot \vec S = (3 \hat x + 4\hat y) \cdot (3 \hat x - 4\hat y) = (3\times 3) (\hat x \cdot \hat x) + (4\times -4) (\hat y \cdot \hat y) = 9 – 16 = -7$ joules.
The force and the displacement have been each been split up into two components and then the work done along each of the two directions has been evaluated and the total work done evaluated as the sum of the work done in each direction.
So the dot product allows you to multiply (scale) in two directions.
The dot product also enables you to simplify such a multiplication even more because $\vec F \cdot \vec S = FS \cos \theta$ where $\theta$ is the angle between the directions of the two vectors.
This equation can be interpreted as $ F\,(S \cos \theta)$ where $S\cos \theta$ is the projection of $\vec S$ onto the direction of $\vec F$ or as $ S\, (F \cos \theta)$ where $F\cos \theta$ is the projection of $\vec F$ onto the direction of $\vec S$
In the example $\theta = 106^\circ$ and so the work done is $5 \times 5 \cos 106^\circ = -7$ joules as before.