Normally a professor is paid for eight to nine months each academic year for teaching several courses in the period.
No, professors are paid for doing many things, including teaching. See this question.
However, if a professor gets research grant, he can support himself by the grant in the summer months, or teach less courses.
That’s a misleading statement that’s only approximately correct. Many professors don’t receive summer salary but that doesn’t mean they can’t “support themselves in the summer months” - the base salary is usually adequate for supporting oneself. And it’s not always an option to teach fewer courses - that depends on the nature of the grant and on the department agreeing to a course buyout.
if a professor only teach the half of the normal load of courses, then he will receive half of his normal salary from the department and the rest is covered by the grant, right?
No, again your math shows that you are assuming the incorrect premise that professors are only paid to teach. Even if there is a well-defined percentage X such that X percent of the professor’s salary is given for teaching (there isn’t always such a number), the amount that will be charged to the grant for a course buyout may not directly correspond to a simple arithmetical calculation of the sort you suggested. As others have noted, every institution will have its own policies about such things.
If the grant is large enough, can he choose not teaching any course without loss of pay?
Professors never “choose” how much they teach. They get assigned teaching by their department, and are required to teach the number of courses that they are assigned. But given appropriate grant funding, they can request permission from the department for a course buyout, and if that permission is granted then they can teach less than the normal load. In some places this is a routine matter and effectively professors can assume that permission will always be granted; in others it may not be.
Also note that it’s not just the size of the grant that matters. The grant budget and policies of the funding body have to be compatible with using the money for a course buyout. That won’t always be the case even when the grant is “large enough”.