This is a problem with the Valeo anti theft steering locks on these and E36's built Jan '95 onwards. There is a plastic tab on the barrel that is designed to shear off if the lock is forced - this wears out over time leading to barrel spin. You can fix this FOC by drilling small hole in the lock casing and then into the barrel, fitting a small self tapping screw to hold the outer barrel secure. You do this just underneath the plastic lug where the two EWS wires go in. If the screw does in too far the lock won't turn so back it off until it does. Cut the screw head off afterwards and it's fixed but the screw will need drilling out if you need to remove the barrel.
The lock jamming can be this broken plastic bit breaking and getting stuck and it can be a worn out barrel causing one of the locking plates not retracting. Either way, you can't get the lock barrel out.
Your best bet is a complete used E36/Z3 lock unit and key (I don't have one) - you will need to swap your EWS chip from the old key to the 'new' one. Replacing the lock is a right b*****d, frankly. Steering wheel off, drips the column switch unit off and you have the mother of all bastards, the spring ring. Getting this off requires very good circlip pliers, refitting it can take 20 seconds, or an hour. I made a special tool from a short bit of steel tube that uses the steering wheel bolt to press the circlip over and into the groove.
Then you have the two shear bolts. A long thin flat blade screwdriver with a sharp end is needed to loosen them and drive them around and out. New ones are a few quid from BMW, part number 32311157967 and you need two. A new spring ring is 32311157968 and it's worth buying one.
See above for the auto/manual lock differences. Be aware that pre 1/95 E36 locks do not fit as the steering column tube is a different diameter.