Many learners have asked the same question and as much as I hate to disappoint you, there are grammar rule that don't fully explain the "whys" in English. The verb "try" is one of those exceptions that can either take an infinitve or gerund form depending on context. He has tried to quit smoking before but failed.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.