The 20-year-old top seed from Spain was leading 6-2, 3-2 when Koepfer retired, having rolled his ankle at a grimace-inducing angle minutes into the match.
Alcaraz will play Lloyd Harris of South Africa in the second round.
"He's a great player, he has big shots so I have to be really focused on the match," said Alcaraz.
Koepfer buried his head in his towel after Alcaraz forced him into a forehand error to convert on a break point chance in the seventh game.
Koepfer fended off a pair of break point chances in the fifth game before solemnly walking to the net to resign.
Persons:
Spain's Carlos Alcaraz, Germany's Dominik Koepfer, Shannon Stapleton, Carlos Alcaraz, Dominik Koepfer, Arthur Ashe, Koepfer, Alcaraz, Lloyd Harris of, Novak, Frenchman Alexandre Muller, Amy Tennery, Neil Fullick
Organizations:
Tennis, Germany's Dominik Koepfer REUTERS, U.S, Wimbledon, Thomson
Locations:
Flushing Meadows , New York, United States, Spain, Lloyd Harris of South Africa, German, New York