The first people to shave in space were the Apollo 10 astronauts. Which one however is unknown. You'd have to ask Thomas P. Stafford as he is the only Apollo 10 crew member still alive. Razors were allowed on multiple flights (such as Gemini and soviet missions) but Apollo 10 was the first time anyone actually shaved in space. This passage can be found here.
... the first in-flight shaving was done on Apollo 10
...
On Gemini [presumably after Gemini 7] through Apollo, the crews were issued with Gillette Techmatic safety razors but they apparently went unused until the flight of Apollo 10.
This is a picture of John Young shaving in-flight on Apollo 10.

+1for finding such an authoritative source on shaving in space! "...there is actually at least 30 minutes’ worth of presentation material on the topic of shaving in spaceflight." Great answer and great link! – uhoh Jul 29 '19 at 22:10