In Captain Marvel we see that the cat hurts Nick Fury, but they were both on the same team. Was this an accident or did the cat think it is funny?
He was acting like a cat.
Goose didn't like the way Nick was treating him and thus scratched him. (Goose is a Flerken, but has the body of a cat)
The man-cat love story goes smoothly - that is until the mission is over, when Fury, Maria Rambeau, Carol and Goose are all headed home. Apparently, Goose doesn't appreciate the way Fury is handling him at one point, because the Flerken reaches up and scratches Fury right across the eye!
So, the simple explanation was that Goose didn't like the way he was being treated and retaliated.