What is the opposite of Optimal?
Solution 1:
Taking the classical approach, optimal derives from optimus, the Latin superlative to bonus, meaning good.
Looking at the Latin for bad, that is malus.
bonus -> melior -> optimus
malus -> peior -> pessimus
So analogous to optimus becoming optimal, pessimus would become pessimal.
All that said, I have never heard that word used.
We do use plenty of the forms of Latin good and bad, as in ameliorate, pejorative, optimal, optimist and pessimist. However, pessimal never seems to have made it far in the popularity contests - it did get into the dictionaries though!
Solution 2:
Since pessimal is correct in the worst possible way, I would look more carefully at the specific usage. One common antonym in discussions of algorithms that would probably fit many usages is "worst-case." You will often see optimal and worst-case performance contrasted as well as optimal (aka best-case) scenarios and worst-case scenarios.