The probability of a continuous density function f(x), here = x^2, is calculated as the probability of the area bounded in the range. It's a norm we follow because there is no other fruitful way to calculate the probability of a function especially if its domain can’t be bounded, as in here. I can write a whole bunch of reasons but that would be very tedious so I’m posting some links where you can learn more about it:
https://www.quora.com/Why-the-probability-is-the-area-under-some-curve
https://opentextbc.ca/introbusinessstatopenstax/chapter/properties-of-continuous-probability-density-functions/
https://math.stackexchange.com/questions/506925/why-the-area-under-the-probability-density-function-curve-is-probability