... Yep, the author left some explanation to the equation. Y = x^2 + 2x + 2 doesn't even have any local maximum, and it's only local minimum is (-1, 1). Hence, the only way to get a maximum point of (1,5) is to have the domain restricted to a <= x <= 1 with -3 < a < 1. The lower bound must be more than -3 since the for x= -3, y=5 as well.
That being said, I should really sleep instead of correcting a Math question in a romcom manga.