Answer:
Mechanical would have been conserved if only the force of gravity (the weight of the object does work on the system). The tension force does work also on the system but negative work instead. The net force acting of the system is zero since the upward tension in the string suspending the object is equal to the weight of the object but acting in the opposite direction. As a result they cancel out. In the equation above the effect of the tension force on the object has been neglected or not taken into consideration. For the mechanical energy E to be conserved, the work done by this tension force must be included into the equation. Otherwise it would seem as though energy has been generated in some manner that is equal in magnitude to the work done by the tension force.
The conserved form of the equation is given by
E = K + Ug + Wother.
In this case Wother = work done by the tension force.
In that form the total mechanical energy is conserved.