The Madera County Sheriff's Office said on Facebook the incident happened around noon when the 24-year-old hiker from Fresno attempted to cross Angel Falls near the village of Bass Lake, located about 14 miles from the south entrance of Yosemite National Park.
"The flow overwhelmed and swept him into a whirlpool, which held him under," the sheriff's office said.
The sheriff's office said the 24-year-old misjudged the swiftness of the water when he decided to walk across.
With snow runoff, the cold spring water is flowing at about 50 to 80 feet per second.
"That’s about like 50-80 basketballs full of water every second," the sheriff's office said.
As the man was struggling to stay above the water, an off-duty California Highway Patrol (CHP) officer just so happened to also be hiking nearby along the Willow Creek trail above Bass Lake.
Off-duty CHP officer Brent Donley, who also just so happened to be trained in search and rescue and in possession of a rope, quickly responded to help.
Donley saved the drowning 24-year-old by throwing him a rope and pulling in to safety as onlookers watched. Donley was able to then pull the man to safety with the help of other good samaritans.
The off-duty officer stayed with the Fresno man and provided first aid until search and rescue deputies and EMS arrived at the scene.
"We sincerely thank Officer Donley for his quick-thinking and preparedness," the sheriff's office said. "This search and rescue call could have ended very badly if not for his help."
The sheriff's office said the man who was rescued was lucky and "needs to buy a lottery ticket." Officials stressed that those planning to visit the mountains, especially in spring as snow melts away, should not attempt to cross swift water.