The grammatic name and function for "what he did" is bad

What he did is bad.

What he did is a noun phrase in a 'fused' relative construction, functioning as subject of the sentence.

It's called a fused relative construction because the single word what combines or fuses the functions of head and relative word to give the equivalent of the thing which.

The meaning is like that of the non-fused The thing which he did is bad.