<sub>This answer is partially speculation, but built off of evidence</sub>

She was likely there to spy on Dumbledore.
-

During Voldemort's first rise, McGonagall and Dumbledore were working for rival anti-Voldemort agencies. McGonagall used her Animagus form to do spywork for the Ministry, while Dumbledore led the Order of the Phoenix.

>Minerva McGonagall did not teach the young Tom Riddle, but she was privy to Dumbledore’s fears and suspicions about him. **Minerva was not inducted into the Order of the Phoenix during Voldemort’s first climb to power (at that time the Order of the Phoenix was seen as a renegade outfit by the Ministry; successive Ministers feared Dumbledore’s charisma and magical talent, and were inclined to harbour fears that he wished to succeed them).** Minerva’s abilities as an Animagus were to prove useful in these dark periods of wizarding history, however, and unbeknownst to her students she spent many nights spying for the Ministry in the guise of a tabby cat, bringing the Aurors crucial information on the activities of Voldemort’s followers.  
<sub>[Pottermore - Professor McGonagall](https://usd.shop.pottermore.com/products/short_stories_from_hogwarts_of_heroism_hardship_and_dangerous_hobbies_ebook_english) (behind paywall)</sub>

Additionally, McGonagall wasn't expecting Dumbledore to recognize her, and Dumbledore wasn't expecting her to be there.

>“Fancy seeing you here, Professor McGonagall.”  

>He turned to smile at the tabby, but it had gone. Instead he was smiling at a rather severe-looking woman who was wearing square glasses exactly the shape of the markings the cat had had around its eyes. She, too, was wearing a cloak, an emerald one. Her black hair was drawn into a tight bun. **She looked distinctly ruffled.**  

>**“How did you know it was me?”** she asked.  

>---

>It must have made sense to Dumbledore, though, because he put it back in his pocket and said, **“Hagrid’s late. I suppose it was he who told you I’d be here, by the way?”**

>**“Yes,” said Professor McGonagall.**

><sub>*Harry Potter and the Philosopher's Stone* - Chapter One</sub>