Is it possible to have an electric motor with an alternator attached to charge the batteries?
Are there any scientific principles that would keep this set up from running indefinitely?
This notion goes back hundreds of years. It is worth a thought because its analysis yields an understanding of related aspects of this sort of device.
Yes, you could connect these parts together and your invention would operate. However after awhile you would find that the batteries are running low and the motor is running slower than initially.
There is a law in thermodynamics known as The Law of Conservation of Energy. It states that the sum of all energy in a system cannot increase or remain fixed. It practical applications such as your invention, total energy in your system will decrease over time.
Your invention would fail to operate because you forgot to factor in the energy lost due to friction.
All devices including electronic and mechanical are subject to this law of thermodynamics. All devices suffer lost energy due to friction of various sorts. Some frictions include resistance in electrical conductors and rubbing in mechanical devices. Heat is generated and dissipated. Attempting to capture this heat requires other components that will utilize energy just to conserve some portion of the heat being lost.
The study of lubrication and improved lubricants naturally follows from analyzing your invention.
There are some other elemental laws of thermodynamics that you should learn about and study.