Generally, we use an infinitive (versus gerund) after 'be+adjective' combinations. We normally follow prepositions with gerunds instead of infinitives.
However, the expression 'be worth X-ing' is a set phase using a gerund.
As a side note, 'worth' is classified as different parts of speech by various dictionaries. Ignoring the alternative uses as a noun or even verb, some classify it as a preposition in this contex while others as an adjective.
Webster - noun or preposition (adjective listed as 'archaic')
Macmillan - adjective only, with notes about never being followed by infinitive
Cambridge - noun or adjective (see notes about 'be worth having/doing something'
Collins - seems to suggest it's a preposition in AmE, but adjective in BrE, (with both variants also using it as noun and verb)
Dictionary.com - noun or preposition
I think the wiser approach is to ignore the preposition/adjective debate, because as a set phrase it's going to be followed by the gerund regardless.