The federal government’s ability to create new government offices to address responsibilities can be found in Articles I, II and III of the constitution. When a government service is required a law must be introduced to Congress explaining exactly what the government role will be. Laws cannot be passed until the language of the law is agreed upon in special committees formed by the members of congress. From there, if the law is approved by both houses with a simple majority vote, the law is passed to the President, who either signs the law into existence or vetos the law and sends it back for revision.
Once the law has been approved it is up to the Executive branch to implement it. This may mean the creation of a new department or office in the federal government or expanding the power of an existing branch. Each department has its own responsibilities and powers, so our federal bureaucracy is always expanding and changing.
If a law is passed and questions come up about it, these are clarified by the federal court system who’s job it is to interpret the constitution.