When x=0, the left-hand side = 1 but the right-hand side is zero, so this is not an identity, but an equation.
Multiply through by 1-sinx: (1-sin^2x)/cosx=sinx; cos^2x/cosx=cosx (left-hand side)=sinx (right-hand side).
Divide through by cosx: tanx=1 so x=45 degrees.