A variety of tools have been used throughout history for the purpose of shaving. Chipped stone blades, such as those made from obsidian, can be extremely sharp. If you have ever cut yourself on a shard of broken glass - this is similar to what a freshly flaked stone chip can be like. These stone chips can be and were used for shaving.
Alternatively, wooden tools were also used. As hard as it is to believe, you can shave with sharpened pieces of wood. I watched a film documentary some time ago about some of the tribesman who live in Papua New Guinea. These people have a level of technology that is pretty much in the stone age. In one short scene, a woman was shaving the beard of her husband using a piece of bamboo. She later helped shaved the cameraman, who had grown quite a bit of beard himself during the period of filming.
Metalworking was also available during the time period you mentioned. The bronze age starts around 3,000 BC (depending on where in the world you are), which is 5,000 years ago. The first metal used was likely copper, which could sometimes be found in its free elemental form an easily worked. Bronze (an alloy of copper and tin) was discovered soon thereafter. Although copper and bronze are soft metals in comparison to steel, and do not hold their edges for as long, they can still be made quite sharp, and can be repeated sharpened as needed. And because copper has anti-microbial properties, you might have been better offer using this back in the days before antibiotics! The iron age followed soon thereafter, and iron (and various types of unrefined steel) were used as blades alongside other metals.
Shaving was not the only form of hair removal in use. You may have heard of waxing and sugaring - two forms of epilation that work by yanking the hair out from the skin rather than shearing it off. The technique of sugaring was used as far back as ancient Egypt, along with tweezing, to remove body hair. Threading is another form of epilation. I don't know how old this technique is, however, since it requires only textiles, it is likely quite old as well.
I would also add is that body hair varies by ethnicity. For example, some East Asian and Native American men have little or no body and facial hair. And there are other peoples who have extensive hair, as well as various gradations in between.
Hair removal as a practice also varies by culture. Some cultures, particularly those in equatorial regions, practice extensive or even total body hair removal. In other cases, hair removal is frowned upon. Hair removal may be forbidden on religious grounds, such as in the Jewish, Islamic, and Sikh faiths. It may also be mandated, as in the case of tonsure in the Catholic and Buddist faiths, as well as the Sunan al-Fitra of the Islamic faith.
You need to keep all of this mind when you see historical portrayals of people. These portrayals may have been idealized, or lifelike. The people being portrayed may have been naturally hair free, or else they manually removed their hair. Even if they were shown with hair, it might not have been their own hair. For example, in the case of ancient Egyptians, extensive hair removal was commonly practiced, however, fake beards were worn by royalty. So when you see an ancient Egyptian statue of someone with a beard, it doesn't mean they grew their facial hair! This is similar to what occurred in the 1600 and 1700s in Europe - if you see portraits of aristocracy from this time you will note their long flowing curls. In reality they all wore wigs!