You need to understand two things:
How to translate Turning Turtles to Nim, and back.
What the winning strategy is in Nim.
Turning Turtles $\iff$ Nim
A coin with the Head side up at position $i$ is equivalent to a Nim heap of size $i$. That is, $\mathrm{H\,T\,T\,H\,T\,T\,H\,T\,H\,T}$ is equivalent to a Nim position with heaps of size $1,4,7$ and $9$.
Flipping coins numbered $i$ and $j$, where $i<j$, so that coin number $j$ was originally heads, is equivalent to reducing the Nim heap of size $j$ to a Nim heap of size $i$. For example, from $\mathrm{H\,T\,T\,H\,T\,T\,H\,T\,H\,T}$, you could flip coins number $2$ and $7$, resulting in $\mathrm{H}\,\bf{H}\,\mathrm{T\,H\,T\,T}\,\bf{T}\,\mathrm{T\,H\,T}$. If you translate both to Nim positions, this looks like
$$
(1,4,7,9)\longrightarrow (1,2,4,9),
$$
which is indeed like reducing a Nim heap of size $4$ to one of size $2$.
The exception to this correspondence is when both coins are turned from heads to tails. For example, moving from $\mathrm{H\,H,H}$ to $\mathrm{T\,H\,T}$. In this case, the first Nim position was $(1,2,3)$, and it seems like the result should be $(1,1,2)$, since we flipped coins $3$ and $1$. Here, we have to mentally delete any repeated heaps, so instead of $(1,1,2)$, we just get a single Nim heap of size $2$. These repeated heaps do not affect the Nim outcome.
Now that you know how Turning Turtles positions and moves correspond to Nim, all you need to know is$\dots$
Winning Strategy in Nim
To find a winning move in a Nim position with heap size $n_1,\dots,n_k$, all you need to do is the following:
Compute the Nim sum of the heap sizes: $m=n_1\oplus \dots \oplus n_k$. A winning move exists iff $m\neq 0$.
Compute $n_i\oplus m$ for each $i\in \{1,\dots,k\}$. If $n_i\oplus m$ is a smaller number than $n_i$, then reducing the $n_i$ heap to $n_i\oplus m$ is a winning move.
Example
Let's find all winning moves starting from $\mathrm{H\,T\,T\,H\,T\,T\,H\,T\,H\,T}$. The corresponding Nim position is $(1,4,7,9)$, whose Nim sum is $1\oplus 4\oplus 7\oplus 9=11$. Then,
$11\oplus 1=10$, so there is no winning move on the $1$ heap.
$11\oplus 4=15$, so there is no winning move on the $4$ heap.
$11\oplus 7=12$, so there is no winning move on the $7$ heap.
$11\oplus 9=2$, so reducing the $9$ heap to $2$ is a winning move.
Translating this back to Turning Turtles, the only winning move is to flip over coins $2$ and $9$.
Best Answer
It helps to know what it means to say that a Grundy game with 18 tokens is equivalent to a Nim heap of size 4. Imagine you have two tables, one playing the Grundy game with a single 18 token pile, and one playing Nim with a single 4 token pile. One player makes a legal move on one of the games, and then the other player makes a move on either the same game or the other game, and so on. (That's the combination in combinatorial game theory.) Since those two games are equivalent, we can conclude that the second player will always be able to win by making a balancing move on the game that the first player did not choose for their move.
So, just like Nim, you win in Grundy's game if the nim-sum of nimbers of all the piles is not equal to 0, and you win by making a move that leaves the nim-sum equal to 0. Here is the list of nim-values of single piles (from the wiki):
We can see that 3 and 15 both have a nim-value of 1. So if we split the pile of 18 into 3 and 15, the nim-sum left to our opponent is $1+1=0$, so they will lose if we keep up with optimal play.