You can do it yourself. There is no law stating that you have to hire a contractor. However, building a house requires high-level skills and experience, which can take years to learn and achieve mastery.
Contractors are specialists and have learned the business for years. So, you’re better off hiring a contractor to build your house.