A neural network can do new things outside the training data. Random initialization sees to that.
Whether those things are useful is a different question, but it turns out that yes, some of those things are useful. It also turns out that in a large-enough LLM if you give it some kind of idea of what you see as useful then yes, it can pick out the newly useful things.
The second thing you said is basically what's called fine-tuning.