Having played football, he came.
The -ing form in having played football is not a gerund in this sentence and does not act as a noun under any system of analysis.
This is a "supplemental clause", subordinated to the main clause by use of the non-finite -ing form and playing no role in the main clause's structure. Use of the perfect construction in the subordinate clause indicates that its action took place before the action of the main clause.
However, in a different context the same clause could act as a nominal:
Having played football is necessary if you want to try out for the team.
Here both having played football acts as the subject of the sentence; in traditional grammar having would be called a gerund and having played football would be analyzed as a 'gerund phrase'.
SUPPLEMENT:
I think you are confused at least in part by inconsistent terminology employed by different grammarians and teachers for the -ing form of verbs.
Traditional grammars were strongly based on analyzing phrases and sentences as composed from fundamental "parts of speech"—noun, verb, adjective, and so forth—much as molecules are composed from atoms. These grammars distinguished two different uses of the -ing form:
gerund was the traditional name for the -ing form employed "as a noun"—that is, in contexts where a noun would ordinarily appear:
I enjoy good food.
I enjoy swimming.
participle (specifically, "present participle") was the traditional name for the -ing form employed "as an adjective"—that is, in contexts where a adjective would ordinarily appear:
I saw a tall man.
I saw a running man.
Contemporary grammars tend to analyze phrases and sentences quite differently, in terms of syntactic roles: the "part of speech" (usually word class today) is now mostly regarded as useful only in describing the internal structure of a phrase, not its external use. Some grammarians continue to employ the old terms in what is understood to be a modified sense; for instance, the very prestigious Cambridge Grammar of the English Language calls the -ing form a 'gerund-participle', maintaining continuity with historical use but bypassing the historical analysis of the form as representing two distinct "parts of speech".
But for teachers of English, who are more concerned with getting you up to a certain level of pragmatic competence than with the fine points of grammatical theory, these distinctions are not so important. Your teacher probably called having played football a "gerund" or "gerund clause" just so you would have a name for it; as long as you knew how to use the form it didn't much matter what you call it. . . . But the distinction does become important when you move on from simple sentences to more complicated ones.