My house doesn't have ceiling lights

I installed a ceiling fan and the wiring isn't right. My attic has a lot of spray in insulation in it, so its hard to follow the wiring. I spliced into a wire and added a junction box that I thought went to my room, but actually goes to the room next to mine. Now the fan doesn't work if the light switch in the other room is on. The lamp,that is plugged into the outlet that the switch controls, is dim when the switch is off, and normal when the switch is on, but the fan doesn't work. Can someone point me in the right direction to fix it properly. I thought just adding another circuit to the run wouldn't do what it's doing. Forgive me for my lack of the correct terminology and thank you in advance.