Prediction is not the heart of science, this is early 20th C. mumbojumbo and humean nonesense that gets repeated by curve-fitters because it's all they do.
Explanation is the heart of science, not prediction. All predictions newton would have made of the orbits of the planets would have been wrong (and so on). And this goes for the vast majority of textbooks physics when its applied to very many ordinary situations: no predictive power at all.
ML models learn "representations" of the data, yes. They are models of measures. The model is just an f=sample({(all possible measures,)}). Science provides representations of the data generating process, ie., reality. It says why those are the measures, why the temperature of gas has that value, not a report on what those values were. Nor even a compressed conditional probability model of those values -- there is no atomic theory in a zip of temperatures.
The purpose of a scientific model is to explain these data-representations, not merely to predict them based on some naive regularity assumption about the measurement device: that it will always measure that way in the future.
The reality of the ML is that it offers only intra-distribution generalisation, nothing of the kind of generalisation science offers where all possible distributions induced by intervention on the (explanatory) variables of scientific models are captured. And this is often a scam that only academics can get away with, ex hyp., just assuming that the test distribution "will turn out as expected" in premise.
The reality is that this sort of repetition of historical data, requires extreme control over the data generating process which gives rise to the test distribution. How is that control delivered in practice? If its a medical lab, through untold amounts of toil delivering, say, histological slides "just right" so this dumb process almost works. If its a face tracking, well you'd be hope its not being used by the police -- because they aint orienting the camera at 3.001m at ISO 151.5 from the masses.
This is the problem with models that obtain predictive power without explanatory content: they rely on prediction time being rigged with, in-practice, extreme control mechanisms that are wholly unstated and unknown by the "modellers". Because these are no models of reality at all, but mere repetitions of historical data with unknown, unmodelled and hence unexplained similarity.
Science concerns itself with explanation, that is its goal. Prediction is instrumental. Engineering's goal is the utility of the product, and so any strategy whatsoever, even a dumb, "if its happened before, itll happen again" is permitted.
There is no textbook of physics which models reality by saying, "Well, we suppose in the future, the positions and velocities will just follow the same distribution, but we've no idea why, and how dare you ask, and get out, and doesnt my Ideal-Gas-TransformerModel look pretty? It gets the pressure right for Argon at 20.0001 C in glass jars at about 2.002L"