"Not only X but also Y " is correct idiom structure but we can not use this structure here because one effect is positive and another effect is negative.
Agreed. This construction does not show contrast, but provides two things going in the same direction. Thus it's inappropriate for the sentence above.
In D "but" is used to show contrast.
Agreed: we have one positive and one negative consequence of the electronic lock.
Tarun not only loves football but also loves hockey.
This sounds fine to me: the two facts about Tarun are similar.
Tarun loves football but may also love hockey.
This one sounds odd to me: it's not really a contrast. Of course, there's some debate to be had over where exactly the boundary is between similar facts and contrasting facts (I agree that there's
some contrast between the sports). I would think that the following sentence is clearer: 'Tarun loves football, but he may also love hockey.' Breaking the sentence into two clauses makes the contrast clearer. Without the extra 'he', my ear expects a simple opposite: 'Tarun loves football, but not hockey.'
Is "but" in D used in the same way as in first sentence?
Yes, it's used for contrast. Here's a similar example: 'Tarun loves football, but often misses training due to his other commitments.'