Many people assume that the relationship between SpaceX and NASA is adversarial. This scenario could not be further from the truth. SpaceX is a private contractor that gives services to NASA. It is not owned or controlled by NASA. However, NASA pays them to carry cargo to the International Space Station. SpaceX has a unique commercial relationship with NASA.
It is called commercial resupply services, which is a series of contracts awarded to them by NASA. They are being paid by them to acquire research and development on specific components for a reusable human-rated space capsule. Many private space companies such as SpaceX, work with NASA.
The correct answer to this question is No. SpaceX is privately owned. They are owned by entrepreneur Elon Musk. Though they are not owned by NASA, they work together with NASA for the purpose of exploring space.
Many get them confused with each other because their main goal is to not only explore space but encourage the public to learn more about the space we live in and surrounding us. NASA is a government establishment owned by the government. Deeper than that, NASA is a customer of SpaceX. Out of all of their customers, NASA is SpaceX's biggest customer to date.