The short answer
Africa is older. Egypt is a country located in the northeast corner of Africa, so the comparison is between a whole continent and one part of it. The African continent, as a landmass, is hundreds of millions of years older than any human state, and human beings themselves emerged in Africa long before Egypt existed.
Africa as a landmass
Africa’s continental crust is very ancient. Parts of it are among the oldest rock on Earth. The continent as we know it took shape as the supercontinent Gondwana broke apart over many millions of years. None of this has anything to do with human history, which is a tiny slice of the story.
Africa as a name
The word “Africa” itself has a much shorter history. It comes from Roman usage, where “Africa” first referred to the area around Carthage in what is now Tunisia, and the name gradually widened to cover the whole continent. So the name is far younger than the land, and younger than ancient Egypt. Ancient Egyptians did not call themselves African or their land Africa. They called their country Kemet, “the black land,” after the dark Nile soil.
Egypt as a state
The usual date for the unification of Upper and Lower Egypt is around 3100 BC, which is the beginning of the Early Dynastic Period. That makes Egypt one of the oldest known states. The modern Arab Republic of Egypt, by contrast, is much newer, with its republic dating to 1953. So “Egypt” could mean either an ancient civilization of about 5,000 years or a modern country, and the answer to “how old is it” depends on which you mean. For wider comparisons, see what is the oldest civilization in the world.
Human history links them
Humans evolved in Africa. Fossils from Jebel Irhoud in Morocco have been dated to roughly 300,000 years ago and are among the oldest known remains attributed to our species. People were living along the Nile long before pharaohs, and who lived in Egypt 10,000 years ago is a question with its own answer.
Why the question gets confusing
People often search this when they are comparing “oldest” things: oldest continent, oldest civilization, oldest country. Africa wins as continent, and Egypt is often cited among the earliest civilizations and states, but they are not rivals. One contains the other.