The loss of sensation on the opposite side of the lesion is because the nerve fibers of the spinothalamic tract (which carry information about pain and temperature) crossover once they meet the spinal cord from the peripheries.
The loss of sensation on one side of the lesion is due to the crossing pattern of nerve fibers in the spinothalamic tract, which carries pain and temperature sensations. These fibers cross over at the level of the spinal cord before entering it from the periphery.