Those aren't hyphens, they are dashes. A hyphen joins two or more words together while a dash separates words into 'parenthetical statements' or introduces a comment. A parenthetical dash can usually be replaced by a comma.
A parenthetical statement is one that adds information, but which can be removed (along with the dashes) without destroying the grammar of the sentence.
Dashes and hyphens are sometimes confused because they look similar, but they are used differently. Hyphens are not separated by spaces, while a dash usually has a space on either side.
My coat is worn-out.
My mother is a hard-to-please sort of person.
'Treasure Island' is a well-liked story.
My mother — who is Belgian — speaks three languages.
My trip to China — which lasted for three months — was expensive, but very interesting.
Dashes before a comment:
You might think my mother drinks too much — she does.
The Russians want peace — or so they say.
The modern convention is for a dash to have a space before and after, but you may find older material where there is no space (the dash is solid next to whatever precedes and follows it).
It is good style to use a dash which is longer than a hyphen, and there are two common sizes, the 'em' and 'en' dashes.
Em dash — can function like a comma, a colon, or parenthesis.
En dash – most often used between numbers, dates, or other notations
to signify '(up) to and including'. Mostly encountered in typeset
material. (A hyphen does its job in other text.)
Hyphens and dashes