I'm trying to plan out how to run the wire for my electrical outlets. I thought I could save wire by branching my hot wire in two different directions. Is this code? Is there a drawback? I would make sure there was enough room in the box.
Electrical wiring must be in a "tree" topology for cables. Most of the time it is in more of a vine topology, but that is a kind of tree. That is, you can split off branches anywhere that is inside a junction box. You would then have 1 supply wire and 2+ onward wires for each of hot, neutral, and ground. Since it's in a junction box, you could put a receptacle or switch there and join its hot and neutral also.
What you're not allowed to do is loop cables back onto other cables: branches of the tree cannot rejoin. AC power actually kicks out very strong EMFs. If power went out one branch and came back another, it would throw EMF all around the circle, which would be a serious problem that can cause vibration and inductive heating. But if all the wires in a cable add up to equal and opposite current, the EMFs cancel each other out. A tree layout for cables ensures that.
Following up on that same rule, every hot needs to return current on a neutral or other wire in that same cable. So when you branch hot, also branch neutral and ground as well. It is less critical for ground to be in a strict tree layout, since current only flows on ground during fault conditions.
Lastly, every branch must be inside a junction box, and those cannot be buried where you would need tools or disassemble the house to access the junction box cover.