My teacher insisted that the sentence requires the word 'achieve' or 'get'. She claimed that the sentence should be written 'What is your secret to get success?'.
A preposition usually sits before a noun to show its relationship with something else in the sentence. There is no reason why this can't be another noun.
e.g. It is a tray for apples.
I judge that "secret to success" is fine. Moreover, it's a set phrase in common use.
Your teacher ought to think of the word 'to' as a preposition and not as part of an infinitive verb.
Don't beat her up on this one. You may have scored a goal, but I bet she's winning 8000:1 in the grand scheme of things.