Suppose we have a rectangle made with $h$ horizontal lines and $v$ vertical lines. We can assume without loss of generality that $h\le v$.
The number of squares with side length $s$ is $(h-s)(v-s)$. The total number of squares is therefore
$$f(h,v) = \sum_{s=1}^{h-1} (h-s)(v-s)\\
=\sum_{s=1}^{h-1} (hv - (h+v)s + s^2)\\
=\sum_{s=1}^{h-1} hv - (h+v)\sum_{s=1}^{h-1}s + \sum_{s=1}^{h-1}s^2\\
=h(h-1)v - (h+v)\frac{h(h-1)}{2} + \frac{h(h-1)(2h-1)}{6}\\
=\frac{h(h-1)}{6}( 6v - 3(h+v) + (2h-1) )\\
=\frac{h(h-1)(3v-h-1)}{6}$$
We want to have $100$ squares.
$$ \frac{h(h-1)(3v-h-1)}{6} = 100 \\h(h-1)(3v-h-1) = 600 = 2^3\cdot 3\cdot 5^2$$
So we need $600$ to be divisible by two successive integers $h-1$ and $h$. There are not many possibilities to check.
$h=2$ gives $v=101$
$h=3$ gives a non-integer value for $v$ when we divide by its coefficient $3$
$h=4$ likewise
$h=5$ gives $v=12$
$h=6$ gives $v=9$
The next value of $h$ for which both $h$ and $h-1$ divide $2^3\cdot 3\cdot 5^2$ is $25$, but then $h>v$, and this formula is not valid there.
So the solutions are:
$(h,v)=(2,101)$, or a $1\times100$ rectangle, using $103$ lines
$(h,v)=(5,12)$, or a $4\times11$ rectangle, using $17$ lines
$(h,v)=(6,9)$, or a $5\times8$ rectangle, using $15$ lines
So $15$ lines is the best.
Those are just the solutions with a perfectly rectangular grid. It should be checked that no non-rectangular grid works better.
You could remove one or more unit squares from a corner of a rectangular grid to get an arrangement that has fewer squares, but which uses the same number of lines. Fortunately though, no rectangle with $14$ lines produces more than $100$ squares (the best is $h=v=7$ which gives $91$ squares).
Let's check that there is no alternative solution. The only rectangle with $15$ lines and more squares is $h=7$, $v=8$, the $6\times 7$ rectangle. It has $112$ squares. If you remove one corner unit square, six squares disappear, one of each size. You can then remove the square next to it on the long side to get rid another six squares, leaving exactly $100$ squares. Instead of the adjacent square you could remove one of the corners on the far side.
So this gives three alternative optimal solutions with $15$ lines.
Here are pictures of the alternative solutions: