Soon after the Egyptian pharaohs united Egypt into one country, about 3200 BC, they needed government officials to run things, and they needed to keep records. Writing was invented soon afterwards. Nobody's sure whether the Egyptians invented writing for themselves, or got the idea from Sumerian cuneiform, which is a little bit older.
Hieroglyphs are drawings of familiar objects, simplified to make them easier to draw. At first people just drew a dog or a house or a sheep; for example some early writing is just a picture of a sheep with five lines by it to mean "five sheep." That was good enough for collecting taxes, but not for anything more complicated. So people began to combine pictures, so that a picture of a sheep means the sound "sh"and can be combined with a picture of an owl "hoot" to mean the word "shoot," for example (only in Egyptian of course, not in English really!).
The Egyptians first called their writing "pictures," and later "writing God's words"; the Greeks translated that into Greek as "hieroglyphs" or "sacred drawings". Hieroglyphs were too hard for most people to learn; the only people who could write were professional scribes. Most of them worked for the government.
But even ordinary people began to see that writing was useful. By about 2000 BC, the Egyptians developed simpler, faster hieroglyphs, and more people learned to write. We call this writing "hieratic" or "demotic", meaning "for the people," from the Greek word demos, - "people".
But after the Greeks conquered Egypt under Alexander the Great, first the government and then other people began to use the Greek alphabet to write the Egyptian language. Then hieroglyphs were only used for religious things, things that were too holy for the ordinary Greek alphabet. By 300 AD, as people converted to Christianity, there was no longer any religious use for hieroglyphs, and they went out of use altogether - the last known use is from 394 AD.
Hieroglyphs : The Writing of Ancient Egypt, by Norma Jean Katan and Barbara Mintz (1981). An introduction for kids, with historical context.
Hieroglyphs, by Joyce Milton (2000). With stencils, so kids can write their own names and other things in hieroglyphs.
The Hieroglyphs of Ancient Egypt, by Aidan Dodson (2001). Well illustrated, and the author is an expert.
The Mystery of the Hieroglyphs: The Story of the Rosetta Stone and the Race to Decipher Egyptian Hieroglyphs, by Carol Donoughue (1999). For kids, about how modern people figured out how to read ancient Egyptian hieroglyphics. A Parents' Choice book.