It's called I2C Multi Master and you have to write software for collision detection. If it's only 2 devices just set one as a Master, the other as Slave.
A better description of your circuit/software would help. Chip numbers, bus speed, pullup values, hardware/bit banged. The more information you supply the more likely someone will figure out what is wrong.
If you are bit banging the I²C then have you implemented clock stretching?