Some people, like me, come up with millions of ideas. Some people don’t.
I learned about my detailed area my senior year of college, got to work on it in general in grad school, and as I learned more came up with an idea which I finally did. I basically told my adviser what I was going to do - since it was in the area of his grant, that was fine.
Those without ideas get told what to do, often something promised in a grant proposal (or going to be promised in the next grant proposal.) Anyone familiar with the area should be able to come up with lots of topics - if this is a problem it is an indicator that the interesting work in the area has been done already and it is time to look elsewhere.
Some that I am aware of:
Physics: as an undergrad, I had a job as a lab assistant. Most of my year was spent on a project that led to a PhD for the grad student doing a lot of the work, under the supervision of a professor. Someone at another school had claimed to have detected a previously undetected particle (magnetic monopole), and other groups were trying to either verify or debunk the claim. That guy has a very nice job at the Large Hadron Collider at this time, though he is also officially part of a US university faculty.
Human Performance (or something): high school friend did a dissertation dealing with something like visual cues used for long jumping. Not sure where he got the idea, but he is currently a professor in the Kinesiology and Health department at a US university. His area is Exercise Science. I don’t think he ever gets kidded about his PhD.
Statistics: I found my topic as part of a survey class in grad school. Our only project was to do a literature review of some area of our choice related to the general topic of the class. After doing a small lit review, I came up with an idea that looked like it could be defended, and the prof agreed. I just had to do more lit review, and work on the actual dissertation. I think that I got lucky in finding something like that. I currently work in big pharma R&D.