We find in Snape's old potions book that he has invented some of his own spells while at school. How hard is it to do that? And why hasn't Harry done it yet?
There are quite a few other people who invent their own magic while in school:
- Fred and George apparently invented most of the magic for their joke shop.
- The Marauders' Map is a seemingly unique object created by James/Sirius/Remus/Peter as teenagers.
- Dumbledore was probably inventing spells before he left Hogwarts: Griselda Marchbanks has a line in Order of the Phoenix about how he "did things with a wand that I'd never seen before" on his exams.
- Ginny may or may not have invented the Bat-Bogey Hex. So far as I'm aware, she's the only one who ever casts it; George refers to "her Bat-Bogey Hex", but it's not clear if he means she invented it or just that she casts it particularly strongly.
- Similarly, it would not be surprising if Hermione invented the Dumbledore's Army jinx (it certainly is nonstandard enough that nobody else was expecting it).
So I'd assume it's the kind of thing that many bright teenagers could find themselves getting up to. Why doesn't Harry? Either because it doesn't interest him, or he doesn't have the talent for it, or because you need to know Arithmancy/Ancient Runes/some other class he's not taking in order to understand how to do it...
To answer the second question, Harry hasn't invented any new spells because *gasp* he's not a very gifted or particularly magically strong wizard. With exception of his flying skills, and some DADA prowess - most of which is really based on personality and not magical abilities - he's a VERY average student at best. He's nowhere near the league of Voldemort, Dumbledore, or even Snape (or Hermione to go a generation down).
As a random confirmation (as if one is needed), look at Sorting Hat. It didn't even remotely consider adding him to Ravenclaw (brilliant) or Hufflepuff (studious) - only two houses dominated by personality traights (Slytherin and Gryffindor).
He also always had to join Ron in copying off of Hermione's notes, having hermione help with homework etc...
Logically (meaning I have no real proof) I think its one or more of the following:
Harry not being raised in a magic environment can perform magic, however does not truly accept magic or is at one with the magical forces.
Creating magic is a dangerous thing since one is basically channeling a force through their bodies. Pretty sure their is not a safety switch for new magic.
Creating magic takes time and research and since Harry is always chasing down clues or stopping the forces of Voldemort he does not have the time to do it.
Hogwarts does not allow underage magic users to cast spells while away from the school. One could say this applies to creating new magic.
I don't really think Hermione created the enchantment on the DA scroll of names because there are such things as unforgivable vows, magical contracts (like the one on the Goblet of Fire) that bind people to things or agreements, which have nasty side-effects when broken.
I personally think the reason why everyone seemed surprised when they saw Marietta was because they either don't know much about magical binds or they didn't think someone like Hermione -- a goody-two-shoes -- would do such a thing.
Also with the bat-bogey hex of Ginny's, I remember vaguely someone mentioning that Bill Weasley taught Ginny that spell, and then was amazed at how well she cast it and how powerful it was. And that Slughorn mentioned it was far the best bat-bogey hex he'd seen! Also with the twins I do think they created quite a few spells which were never mentioned but most likely they altered spell/potions to get the effect they wanted.
I see the possibility that Harry actually invented some spells but it is never mentioned in the books.
Also, I'm not sure if we can consider this as "inventing a spell", but we know he performs magic he didn't knew before, like making his hair grow again when aunt Petunia cuts it, making a glass disappear or blowing up his aunt.