Is a C2328 Transistor OK to use instead of a 2N2222?
I assume your magnet does not draw a large current, let's say up to 200mA or so.

Q1 can be replaced by almost any transistor, the one you mention should do fine.

The effect that you describe could well be cause by D1 not working (failed open). The high-voltage pulse caused by switching the relay off would not be dissipated by D1 but instead destroy Q1.