That’s cryptographically signed and therefore strong evidence of what you wrote when, and what you were thinking.
This logic doesn't work out in the given place.
Cryptographical signatures are used to determine that the thingy was made by the person you trust.
Problem is, in this case, the creator of those commits is the one that is not being trusted.
The professor will just go, "Oh you made it with AI and then used git commit!".
I have had a similar experience in the past, where I made some MATLAB code for a Mathematics course, which the professor said I had copied from someone else (pre-AI times), because he had given the same assignment to other people in the university. This, he claimed without even looking at what I made and without remembering the specific question he had passed to me.