Byron Maradiaga reportedly flashed the weapon in the patio area of a Sharkey's restaurant on the 1900 block of Newbury Road in Newbury Park on May 11.
The Thousand Oaks Gang Unit identified Maradiaga as the suspect in the incident and tracked him down on Friday outside of a house on Paseo Esmeralda.
The suspect tried to flee when he saw officers, but authorities found him in a garage after a short foot chase. He was taken into custody without incident.
Maradiaga was arrested for brandishing a deadly weapon and street terrorism.