The power (from the breaker) is likely at the light fixture. When you hook black to black and white to white, the light is powered directly from the breaker. In this configuration, when you flip the switch on
you create a short through the switch.
![enter image description here](https://i.stack.imgur.com/jT3uR.png)
What you need to do is hook it up like this.
![enter image description here](https://i.stack.imgur.com/nIJ8Y.png)
Notice the white wire that runs between the switch and the light has a black stripe on it (in above image), that lets anybody that works on this light in the future know that the wire is switched. You can mark the wire using a bit of electrical tape, or a marker.
Figuring out which wires come from the breaker, and which go to the switch will require some tools. First Turn off the breaker, and verify the power is off using a non-contact voltage tester. Now pick one set of wires to work with first (one black and one white from the same cable). Turn the switch to the on
position, and use a multimeter to check continuity between the two wires. If the wires are connected (low resistance), these are the switched wires. If not (infinite resistance), check the other set of wires. If neither pair pass the test, contact an electrician.
If at any time you don't feel comfortable doing this work, or you don't have the proper tools to complete the task. Contact a local licensed electrician.
This fixture is not wired per code, you should have only one white wire for each colored wire, you should never have only one colored wire and more than one white wire.
What the previous posters are suspecting is you have a three-way circuit so that two or more switches can control the fixture.
You can use a multi-tester of test light to see if you have current between the black wire and one of the white wires when the switch is turned on. If you have current through more than one white wire then stop and call an electrician. You might inadvertently overload a neutral. If your switch does not read on and off then you probably have a three-way circuit and you may need an electrician to sort it out.
Best Answer
You probably have a standard switch loop and a cable that goes out to another part of the circuit.
It's basically this with an extra cable coming in, which would simply be connected by color to the supply cable wires.
You'll have to do some sleuthing with your multi-meter to see what's what.