The different planets that form our solar system all have various temperatures, but there is more to it than how close they are to the sun. If that was indeed the only contributing factor, then Mercury would be the hottest planet due to its proximity to the sun, but it’s not.
Instead, it is Venus that has been shown to be the hottest planet, and it is all to do with the various gases that make up a huge part of the planet. Ultimately, these gasses that are in the atmosphere surrounding Venus create what is basically its own version of the Greenhouse Effect, so it has less protection from the solar power from the sun, leading to warmer temperatures on the surface than any other planet out there.