The "Best" algorithm (which always choose the best possible play) is known to be NP-Complete.
Therefore it is really hard to implement "good" one, which use some heuristic to increase performance and it is precious enough.
Minimax is basically only approach which "really" works, so start with it, then you can think and look for optimization. The idea is simple, you try every movement and you measure the "price" of that movement (e. g. creating more same "X" or "O" in row has better price than creating "X" or "O" than most things, or stopping a long line of "X" or "O" of enemy is good too).
Then for every possible movement, you try enemy to do the every possible movement and you count the price.
How "deep" you go, the more precious it is, but the more expensive for performance algorithm is.
For that example I said, for every your movement you do every enemy movement - you suppose that opponent would play as good as possible, so you from all that movement the opponent plays you get the maximum (the maximum for him).
And now for every possible movement, you have the value of best enemy play. And then you choose the minimum - it means that you want to choose the best for you and worst for enemy.
That's why they call it minimax.