Yes, citric acid is vegan.
It’s a chemical that naturally occurs in citrus fruits (lemons, limes oranges, etc.).
Given that it comes from fruits and is easily obtainable, all citric acid that you’ll find comes from these plant sources, and is therefore vegan.
It was first isolated in a lab in 1784 by Carl Wilhelm Scheele using lemon juice.
You’ll often find citric acid added to soda for flavoring purposes, but is also used in cleaning supplies, cosmetics, and more.