This is a very famous problem. Here is a quick sketch.
First of all the idea to be noted is that if at any point of time in the game, Ana writes a $1$, then Bob can repeat all of her subsequent moves(including the current zero one). This is because if Bob plays this way he ends the game such that the final number has pairs of zeroes at the end and upon removal of these we have a pair of ones. This is a good thing for Bob indeed, since now this number cannot be expressed as the sum of $2$ squares.(the idea is that $4n \in Q_2$ if and only if $n \in Q_2$ and $4k+3 \not \in Q_2$)
So, that means that it is never optimal for Ana to put any one. So we may assume that she always places zeros. Now we make Bob do that exact same thing for the first $2018$ turns, and then just put $1$'s for the last three turns. The resulting number is $(10101)_2 = 21$ which can be seen to not be expressed as the sum of $2$ squares. So Bob has the winning strategy.