What is the subject of this English sentence?
Or in German:
Grammar is very clear about this: If there is only one thing in nominative case, then it must be the subject. (If there are more than one, then it becomes complicated, but even then the subject is one of them.)
So, in this sentence it can't be anything else but »es« (or it in English.) But this it does not make or cause the rain. It does not perform the action as a subject usually does. From the point of story telling it would be enought to say:
The meaning would be the same, just the grammar is wrong. A subject is missing.
To fill this gap, there is an expletive word in many languages, including German and English, and in German this is the word »es« and in English »it«. Although it looks like a pronoun it does not refer to anything like pronouns usually do. So it's not fully correct to call it a pronoun when it is used as expletive word.
Up to this point German and English behave the same. But what comes next is different:
English is a SVO language. This means: An orderly English statement begins with a Subject, followed by a Verb after which optional Objects might appear.
This is not true for German. German is not a SVO language although SVO is the most common word order of German statements. German is a V2 language. This means: In an orderly German statement the (finite) Verb must stand at position 2. This is true for English too, but less strict. The set of SVO languages is a subset of V2 languages.
As a consequence in a German sentence any part of speech can stand at position 1 of a proper German statement, which means, that the subject can also stand behind the verb. And if you want, you can even move all parts of speech behind the verb, so that nothing remains before it.
But wait! When there is nothing before the verb, wouldn't that mean, that the verb then stands at position 1 of the sentence? - Right. And to avoid this, the expletive word comes very handy. You can put it on position 1 to fill a gap that otherwise would be empty. And then you get sentences like these:
Es fährt ein Zug nach Nirgendwo. (Ein Zug fährt nach Nirgendwo.)
Es sind viele Menschen auf der Straße. (Viele Menschen sind auf der Straße.)
Es hat keiner aufgemacht. (Keiner hat aufgemacht.)
There is a train going to nowhere. (A train goes to nowhere.)
There are many people on the street. (Many people are on the street.)
There was nobody opening. (Nobody did open.)
(The first example is the title of a German Schlager (hit song) from 1972.)
In these sentences there is an expletive word with no meaning at all at position 1, and it's sole grammatical function is to fill a gap. So, other than in "it rains" this expletive word is not the subject. It is nothing but a filler of a gap. The subject is on position 3 (»ein Zug«, »viele Menschen«, »keiner«), and it can easily be moved to position 1, in which case the expletive word vanishes.
As you can see, the English construction "there" + form of "to be" does a very similar job. (English has an expletive "there" and an expletive "it", German has only the expletive »es«) And in both languages the overall mood of the statement changes when you add or remove such an expletive word, although the proposition stays the same. (The proposition is that part of the meaning that makes a statement true or false.) And this other mood is the reason why you use this feature in one situation and avoid it in another.