The counts_by_year field is pre-calculated and then stored in entities (like institution, author, source) as a shortcut for users. It gets updated every few months, but it is out of sync almost immediately after it is calculated. For instance, at the time of making this post, if I look at the journal of phycology: https://api.openalex.org/
This number can also change when we add new works to an entity from previous years as well. for instance, if a journal adds new records to Crossref from previous years (not uncommon) or if we make changes to that journal in our data as our disambiguation algorithms get better.