If he is not so stupid that he cannot understand the song, was he actually unable to understand the song

Solution 1:

The short answer: yes, he was able to understand the song.

Your teacher is partly right (and wrong in her conclusion) here; there is indeed an implied meaning, but her analysis is back-to-front. I interpret the line:

He is not so stupid that he cannot understand the song.

in the following manner:

It might be true that he is relatively stupid, but he is not so stupid that he cannot understand the song.

The point is that he would need to be even more stupid than he currently is, in order to not understand the song. I.e., he passes the minimum required level of understanding.

The mistake your teacher appears to have made is interpreting each part of the sentence in isolation:

he is not so stupid (meaning that he has some basic level of intelligence)

and

he cannot understand the song (meaning that his understanding is flawed)

However, you are correct that the use of that as a comparison with an adjective and an outcome changes the interpretation of the sentence:

  • He was so ____ that ____.

Examples include:

  • He was so tired that he fell asleep right away.
  • He has so happy that he didn't notice it was raining outside.

The negation makes your original sentence a little more complex to break down, but it's still just a situation leading directly to a consequence. See this resource for a more in-depth grammatical look at that.

Solution 2:

Your teacher is wrong. "He is not so stupid that he can't understand the song" is the sort of a line that you might expect to hear in response to somebody saying that some guy is too dumb to understand the song. It's the sort of a thing that you might say in defense of somebody when somebody else is suggesting that they're too dumb to figure something out.