The energetic charged particles from the Sun that cause aurora also energize electrons in the Earth's magnetosphere. These electrons move along the Earth's magnetic field and eventually strike the Earth's ionosphere, causing the X-ray emission. These X-rays are not dangerous because they are absorbed by lower parts of the Earth's atmosphere. This image was taken by the Yokoh satellite. Many things in deep space give off X-rays.
Many stars are in binary star systems - which means that two stars orbit each other.
When one of these stars is a black hole or a neutron star, material is pulled off the normal star. This materials spirals into the black hole or neutron star and heats up to very high temperatures. The above image is an artist's conception of a binary star system - it shows the material being pulled off the red star by its invisible black hole companion and into an orbiting disk. This is the same supernova remnant but this image shows only X-ray emission.