Like English, German has countable nouns (zählbare Nomen) and uncountable nouns (unzählbare Nomen). Whether you use "much" or "many" depends on which type of noun you're talking about. For countable nouns, we say Wie viele? ("how many?"), but for uncountable nouns it's Wie viel? ("how much?").
The following example may help to clarify the difference. You can say "three cobwebs," but you can't say "three stuffs," and this is the same in German.
So viele Spinnweben und so viel Kram.
So many cobwebs and so much stuff.
Caption 11, Silbermond: Leichtes Gepäck
Play Caption
In Germany, there are 16 federal states, which makes die Bundesländer a countable noun. Square meters and buildings are also countable:
Wie viele Bundesländer hat die Bundesrepublik Deutschland?
How many federal states does the Federal Republic of Germany have?
Caption 24, Bundesrepublik Deutschland: Einbürgerungstest
Play Caption
Wie viele Quadratmeter hat das Zimmer denn?
How many square meters is the room then?
Caption 25, Nicos Weg: Meine Wohnung
Play Caption
Wie viele Gebäude sollen nach historischem Vorbild rekonstruiert werden?
How many buildings should be reconstructed based on the historical model?
Caption 19, Rheinmain im Blick: Neue Frankfurter Altstadt ist endlich fertig
Play Caption
Viel is used when the noun is uncountable or singular. For example, "fun" isn't something you can really quantify. And although hours or kilowatts may be quantifiable, time and energy are not.
Ihr werdet mitmachen und dort grillen und sehen, wie viel Spaß es macht, beim Wettbewerb zu grillen.
You will participate and grill there and see how much fun it is to grill at the contest.
Captions 41-42, Konjugation: Das Verb „grillen“
Play Caption
Und wie viel Zeit hab ich?
And how much time do I have?
Caption 36, extra 3 TOYtschland: Unser schöner Bauernhof
Play Caption
Das bringt so viel Energie wie Braun- und Steinkohle zusammen.
That supplies as much energy as brown and hard coal combined.
Caption 27, Terra X: Ohne Kohle und Atom - Geht uns der Strom aus?
Play Caption
Further Learning
Like many German words, these forms change depending on grammatical case. For example, you'll see viele Freunde ("many friends"), but mit vielen Freunden ("with many friends"). You'll find many examples of this on Yabla German!