Legislation passed by Congress grants authority to the Executive to make regulations relevant to a particular topic. It's common for Congress to pass laws that contain language like "The Secretary/Administrator/whoever shall prescribe such regulations as may be necessary to carry out the provisions of this chapter." It might be illustrative to see how this practically works:
So let's look for an example. We'll go to the Federal Register, which contains notices of proposed regulations. Choosing an interesting looking new one, we can look at National Organic Program (NOP); Strengthening Organic Enforcement. That's the new final rule today that tightens the rules for food products labeled "organic". Scrolling through the rule, there are some summaries, a table of estimated costs and benefits, and then we get to the section headed "Authority," which tells us why the Executive Branch (in this case, the USDA) thinks it has the authority to issue this regulation:
The Organic Foods Production Act of 1990 (OFPA) (7 U.S.C. 6501-6524), authorizes the Agricultural Marketing Service (AMS) to establish and maintain national standards governing the marketing of organically produced agricultural products. AMS administers these standards through the National Organic Program (NOP). Final regulations implementing the NOP, also referred to as the USDA organic regulations, were published on December 21, 2000 (65 FR 80548) and became effective on October 21, 2002.2 Through these regulations, AMS oversees national standards for the production, handling, labeling, and sale of organically produced agricultural products.
Ok, so Congress passed a law in 1990 called the Organic Foods Production Act, and that tells the USDA to issue regulations related to the marketing of organic foods. If we turn to the relevant chapter of the US Code, we can see language where Congress delegates to the Executive the authority to issue these regulations. For example, one provision says:
The Secretary shall establish an organic certification program for producers and handlers of agricultural products that have been produced using organic methods as provided for in this chapter.
And then there's a much longer section (§ 6506) that lists the "General Requirements" for the organic food program. Some lay out specific details that need to be addressed in the regulations (e.g. Congress says the regulations have to provide for annual inspections of organic farms by certifying agents) and discretionary ones (e.g. Congress says that the regulations can make certain reasonable exceptions if a farm is subject to an emergency pest treatment program).
Other requirements are quite broad; one says that the regulation needs to "provide for appropriate and adequate enforcement procedures, as determined by the Secretary to be necessary and consistent with this chapter." In other words, Congress isn't saying specifically how this should all be enforced; they're just saying the regulation should provide for the enforcement procedures the Executive considers to be necessary. In turn, the regulation goes into much more detail on inspections, paperwork that needs to be maintained and paperwork that needs to be filed with the government, mediation to resolve compliance issues, appeals procedures, and so on. Congress doesn't want to get into the nitty gritty of super-detailed stuff like the exact process for dealing with appeals of organic food violations. So the law Congress passed just says the Executive needs to include some sort of appeal procedure in the regulations, and it delegates the authority to figure out all those details to the Secretary of Agriculture and their staff, so long as they follow the general process for issuing regulations.
So to sum up, executive agencies gain their authority to issue regulations when that power is granted to them by legislation (n.b. Congress's ability to grant that power is limited by the nondelegation doctrine). Sometimes that legislation may be quite specific, while others times it may be very broad and gives the Executive Branch significant discretion. For example (picking random new regulations):
Congress said the Secretary of Commerce should issue certain types of regulations related to fisheries, so the National Marine Fisheries Service issued a rule about the "Closed Area I Scallop Access Area," wherever that is.
Congress said the Secretary of the Interior may issue regulations dealing with certain matters related to museums and archeological resources removed from Native American lands, and Congress passed another law that says that civil penalties should be updated every year based on inflation, so the Department of Interior issued a rule increasing the fines for noncompliance as Congress directed.
Congress said the Administrator of the Federal Aviation Administration shall issue various types of regulations related to aviation safety, so the FAA is proposing a rule about inspecting for corrosion and repairing or replacing affected parts of landing gears on certain Airbus helicopters.
Congress said we're gonna have the National Marine
Sanctuary System and it "shall consist of national marine sanctuaries designated by the Secretary in accordance with this chapter," so the Secretary of Commerce, via the Office of National Marine Sanctuaries within NOAA, proposes to create the Lake Ontario National Marine Sanctuary.