Understanding how large-scale shapes in tissues, organs and bacterial colonies emerge from local interactions among cells and how these shapes remain stable over time are two fundamental problems in biology. Here we investigate branching morphogenesis in an experimental model system, swarming colonies of the bacterium Pseudomonas aeruginosa. We combine experiments and computer simulation to show that a simple ecological model of population dispersal can describe the emergence of branching patterns. In our system, morphogenesis depends on two counteracting processes that act on different length-scales: (1) colony expansion, which increases the likelihood of colonizing a patch at a close distance and (2) colony repulsion, which decreases the colonization likelihood over a longer distance. The two processes are included in a kernel based mathematical model using an integro-differential approach borrowed from ecological theory. Computer simulations show that the model can indeed reproduce branching, but only for a narrow range of parameter values, suggesting that P. aeruginosa has a fine-tuned physiology for branching. Simulations further show that hyperswarming, a process where highly dispersive mutants reproducibly arise within the colony and disrupt branching patterns, can be interpreted as a change in the spatial kernel.