El Ouafi was born in the town of Ouled Djellal, joining the French military regiment later (at that time, Algeria was part of French Algeria). One of his superior officers noticed El Ouafi's outstanding athletic abilities, and decided to send him to military sports competition in mainland France.
In the 1928 competition, he ran behind the leaders for the first three quarters of the race, overtaking them some 5 km before the end. He was never caught by any of the other runners, and finished first, 26 seconds ahead of second-placed Manuel Plaza from Chile. El Ouafi was the only representative of French athletics to win gold at the 1928 Olympics.
After his surprise victory, El Ouafi toured the United States. However, the money he earned with this trip disqualified him as an amateur, causing him to leave the sport, and he opened a cafe in Paris. El Ouafi remained forgotten until 1956, when another Algerian, Alain Mimoun, also won the Olympic marathon. Reporters went to seek out the other Algerian who had won 28 years earlier, and found him a pauper.
El Ouafi was killed while in a café, three days after his 61st birthday. Accounts of his death vary. French media then said that he was targeted by members of the National Liberation Front after he had refused to support them; other accounts say he was a bystander victim of an argument between family members and revolutionaries, or was killed during a family quarrel.