Did NASA spend millions of dollars to make a zero-gravity pen?

Short answer: No.

Long answer: There is a popular story about how NASA spent millions of dollars developing a pen that would work in the micro-gravity of space, while the Soviets solved the same problem by using pencils. This story is not true.

Both NASA and the Soviets have used used pencils in space but this turns out to be a bad idea. Pencils create numerous example:

A space pen was developed in the 1960s, but not by NASA. It was developed privately by manufacturer Paul C. Fisher. He patented the pen and sold them to NASA for a few dollars each. The Soviets quickly began using the new pens as well.

Fisher Space Pen

Fisher didn’t make much money directly from NASA but he used the publicity to make a fortune selling “Space Pens” to the public. Nowadays space pens are used by police, emergency services, the military, field researchers, adventurers and people working in extreme environments. It is considered one of the great win-win commercial success stories from the space program.

It's unclear where the myth about the expensive space pen originated. While it might be a nice story for motivational speakers to illustrate lateral thinking, it's not real.