That’s not a ‘past’ infinitive—infinitives have no tense—but a ‘perfect infinitive’. The difference a simple construction and a perfect expression is usually that
the simple construction narrates the event, locating it at the time that is being discussed—Reference Time, RT
the perfect construction mentions the event as something that happened before RT and gave rise to an interesting state which obtains at RT
In the case at hand, the simple version BE going to finish would represent John’s prediction of when he would finish his novel, while the given perfect version BE going to have finished represents John’s prediction of when, having finished, he would be free to do something else, such as submit the novel to a publisher.
This prediction is embedded within a continuative present perfect, which represents the prediction as a repeated or habitual state of activity which has persisted throughout the four months leading up to the present—Speech Time, ST.
As Marv Mills points out, there is an ambiguity in the reference of today: does it mean that for the past four months John’s target for finishing the novel has been the ‘today’ of ST or that that has been a moving target, each day of the past four months? In real utterances, context will ordinarily resolve this ambiguity.
But this sentence is not a real utterance with a real context. It is an academic invention† designed to illustrate a grammatical point:
Next to absolute-relative tenses and complex relative tenses, there are a few (nameless) tenses that are even more complex, because they involve three temporal relations:
For four months now John has been going to have finished his novel by today, [but it is not finished yet.] (= ‘For four months now John has said that he was going to have finished his novel by today.’)
Consequently, it is futile to inquire what the author ‘means’: the meaning is not linguistic but metalinguistic.
† Declerck et al., The Grammar of the English Tense System, I, 26.