Is it fair to compare two models one with one of the predictors treated as a continuous variable and in the other, you treat it as categorical variable using ANOVA? Can we call the first model nested under the second?
Nested models are models where all regressors in model A are also included in model B, as-is, without transformations. Thus, a model with a main effect $X$ would be nested in a model with an interaction term $X\times Y$ - as long as the main effect is also present in the interaction model. If the second model does not contain the main effect, then the first model is not nested in the second any more.
In your example, your models will not be nested. Unless, that is, one model contains the continuous predictor and the other one contains both the continuous and the categorical one - but I assume you don't want to do this.
And you cannot compare non-nested models using ANOVA. ANOVA investigates how much additional variance is explained in a larger model compared to a smaller model nested within it.
However, you could of course compare different non-nested models using information criteria (AIC, BIC etc.), or as to their performance in cross-validation.