I can see how this can be confusing.
Он не был в школе.
means "He was not at school".
У него не было плохого настроения.
is properly translated as "He was not in a bad mood," but it literally means "He did not have a bad mood". In English you can be in a mood, but in Russian you have moods.
In general, the construction "У него не было..." followed by a noun in the genitive case is the equivalent of "He didn't have..." For example, "У него не было машины." - "He didn't have a car". And yes, in the negative "было" is always neuter: "У него не было дома." - "He didn't have a house." Notice that there is actually no subject here: nothing is in the nominative case. These are the subject-less sentences that you see in Russian so often.
However, in the positive it has to agree in gender with the noun: "У него была машина." "У него был дом". Notice also that the noun is in the nominative case, and thus becomes the subject of the sentence.
By the way, verbs don't decline, they conjugate.