sir gawain and the green kightWhat does the opening, about nation-building, have to do with the rest of the poem?
The opening sets the poem in both a historical and literary context.
Historically, the connection between the English Kings and the Trojan War is one that was very important to royalty as a means of conferring validation to their claim to the throne. This may be relevant to the patronage that the poet received at the time.
In addition, the opening sets the poem in a literary context as an English Epic, drawing on the tradition created by both the Iliad and Odyssey.
Don't forget these kinds of stories were still largely performed (sung) in banquet halls throughout the country. The traveling performer would have acted as both an entertainer and an ambassador for the peaceful unity of his country as he traveled. (It obviously didn't work, as England was wracked with wars both then and later, but I suppose it was worth a try.)