why same charge repel and opposite charge attract each other?
Every object has a tendency to lose energy (lower it's energy).
Suppose you have two charges q1 and q2 ( same/opposite ) . As the energy of a system is given by :
P.E = k * q1 * q2 / r
k = constant for a medium .
r = distance between charges.
As the body wants to lose energy so P.E (Potential Energy) has to be minimum. For which :
r (distance between charges) should be maximum . Therefore the same charges move away to increase the distance between them (r) .
Now , as if q1 and q2 are two opposite charges. so their product will be negative :
P.E = - k (q1)(q2) / r
Thus for P.E to be minimum : r should be minimum.
Thus opposite charges move towards each other to decrease the distance between them (r) .