When gridlines are defined that are outside the PlotRange the plot area is extended. Not sure when this started to happen (currently under 13.0.1), but it was not like this before.
I see the same problem with 13.0.1 on Windows 10. With 12.3 there is no problem.
I can reproduce the problem on 13.0.1. You should report this to Wolfram Support.
Hi Martijn,
Works fine on "13.0.0 for Mac OS X ARM (64-bit) (December 3, 2021)"
Plot[Cos[x], {x, 0, 10}, GridLines -> {{Pi, 2 Pi, 10 Pi}, {-1, -.5, .5, 1}}]