Perpetual motion is sort of possible.
Since energy is conserved, that is energy cannot be freely created or destroyed, if you set something in motion it will remain in motion.
What causes a object to stop moving is loss of energy from the system, and changes in the type of energy present in the system.
If you take an isolated object, like a ball thrown in an infinite vacuum, it will travel an infinite distance without stopping. There is nothing for it to interact with to take energy away from the ball, and you now have a perpetually moving ball.
Practically you can't create a system that interactions with nothing. If you ever had a chance to fire a rocket out of the solar system you could approximate this situation as interstellar space has very little with which the rocket can interact with, and it could drift possible for millions of years, but eventually it would run into enough of something to stop it.
If you consider a ball rolling a circular track, when you place the ball on the track your give it a certain amount of energy that sets the ball in motion and it will then move on the track for time slowing down until it stops.
As the ball moves through the air it must push it aside giving energy to the air. Energy is being transferred from the motion of the ball to motion of the air molecules. The air molecules will then scatter against each other converting the directed motion of the ball into the random motion of the air molecules.
If you listen as the ball rolls you can hear a sound. The vibration required to make the sounds is taking energy from the rolling ball.
The ball and track are also deforming as the contact each other, this change in shape takes energy away from the rolling ball.
Due to the conservation of energy any loses of energy from the ball will eventually stop it from moving. The ball started with a certain amount of energy, and when that energy was transferred else where the ball stops moving.
You can, by choice of materials and care in construction, reduce these factors to conserve the kinetic energy of the ball (consider a dirt track vs a pool table), but you can never fully eliminate the energy losses from the ball, it will always stop eventually. The kinetic energy of the ball will be by varied, as processes a listed above and by other processes, be converted into heat energy of the system.
Every system (a system in this context refers to an interacting configuration of matter and energy), that is not perfectly isolated will have some kinds of energy loses, and there is no known way to isolate a system perfectly from the rest of the universe.
The reason why you can have very efficient systems, but not completely efficient systems for transferring energy is due to Thermodynamics, mainly the Second Law of Thermodynamics, which states in brief that entropy is either constant or increasing in a system. Entropy is a measure the disorder in a system, and as the disorder increases the ability to do useful work with the energy in the system decreases.
If you are interested in the details of why the Second Law exists, find a text on statistical mechanics, such as Introductory Statistical Mechanics by Bowley and Sanchez, and it can explain the microscopic origins of the laws of thermodynamics, but it takes several chapters to do so, and is usually covered in the second or third year of university physics programs, so it takes a fair amount of background to understand.
In brief, the Second Law means that energy used to do work in system will be converted, in whole or in part, to heat energy, and the energy lost to heat cannot be fully recovered to do other work.
All of the energy loss mechanisms given above for the rolling ball eventually result in an increase in the temperature of the system, and a cessation of the systems ability to do work, that is keep the ball rolling.