Why can't i connect to my Wi-Fi if it works for other networks?

My iPhone is really old is iPhone 2 but then it works fine. But i can't connect to my home Wi-Fi. It connects to other Wi-Fi networks when I'm at a friends house. I'm within the range for me house cause I'm next to the hotspot. For my friends house, I'm in the living room and the hotspot is in the bedroom which is 2 rooms down. Please help me. If i restore my iPhone will my Wi-Fi work?

There's a chance so try to restore or check the settings is correct or not.