How do professors view a student who has good grades but always asks stupid questions?
Students often have a highly distorted perception of themselves with respect to the feelings of their professors. The differential in both power and experience between student and professor is just so large that it's quite common for a student to confuse the very distinct attributes of professorial attitude, personal affection, and intellectual respect.
As such, I would suggest that you really don't know what your professors think of you until you ask them. Maybe you are reading them correctly, but maybe not: many professors are quite pleased to have a student who carefully advocates to improve their understanding of material, even if they might wish to be getting on with the lecture in the moment.
My recommendation is to tell the professor you're thinking of applying to Ph.D. programs and ask them something like:
Do you think that you would be able to write a strong letter of recommendation for me?
The "strong" is important here, because that's what will get you the honest opinion of whether the professor thinks well of you or not, and you don't want letters that are not strong.
Although I do well in most of my classes, I do have a "bad" habit of asking stupid questions frequently. I can see from the faces of professors that they dislike students who always ask stupid questions while welcome students to ask questions. (If you are a professor and don't think this is the case, please let me know...)
I don't think you've provided enough context to really say for sure whether or not your questions would be annoying.
Here's what I'd need to know: Does the professor (or the syllabus) say that you should read from the textbook before you come to class? If so, do you read the book as assigned?
If you constantly interrupted me with a barrage of questions that indicated you hadn't done the assigned reading, then my face might also show some of the consternation that you claim you see.
How do professors think of a student who has good grades but always asks stupid questions?
Generally speaking, I like it when students ask questions. It shows me they are engaged. It shows me they are interested in learning the material. It helps provide feedback when I haven't explained something clearly. Quite often, the one student who is brave enough to speak up is asking for help that other students probably need and appreciate.
That said, though, there are times where there can be too much of a good thing. If one student's questions are so frequent and incessant that it becomes distracting for everyone, that might be viewed negatively. But that's perhaps more of a timing issue than a "stupid question" issue.
While jakebeal's answer is good for what you should do, I'll expound on your titular question:
How do professors think of a student who has good grades but always asks stupid questions?
First, there are a couple of things you could mean here by "always": you're incessantly asking stupid questions or all (or most) of your questions seem stupid to you in retrospect. J.R.'s answer addresses the first, so I'll ignore that aspect except to say you can always ask your professor outside of class if you are asking too many questions during class.
Second, I ask "stupid questions" all the time also, though I don't vocalize most of them, just some of them. I think this is normal for researchers, and it's especially common when you're thinking about something for the first time, or thinking about something in a new way, and trying to understand something in a short amount of time, such as a class meeting. So just because a question has an easy answer, doesn't mean it's sounds stupid to a teacher. It may or may not, so as the other answers say, you may not be able to accurately judge a professor's opinion of your questions without explicit feedback.
However, if these questions are coming long after you should have learned the material (e.g., asking something that's obvious from high school algebra in an advanced math class, or only now asking something that was crucial for understanding what's been going on in the class for the past 10 weeks), then probably the professor will think you don't understand the material as well as you should.
Finally, I get lots of students in math classes who ask lots of questions that make me think they don't understand what's going on very well at all, but then surprise me by doing great on the assignments and exams. This sort of thing seems to be what you're concerned about (though may in fact not be the case). Without knowing anything more specific, generally my impression is they're good students, though probably they didn't have a strong background coming in and/or they're not exceedingly quick. By not quick, I don't mean they're not smart or that they wouldn't do well in grad school--you can be quick and smart or slow and smart. While thinking quickly can be impressive, I view thinking deeply as more important.
I would generally be able to write a good letter of recommendation for such a person, though I would probably be writing different things from "Ti has one of the fastest minds I've ever known."