When I get a chance to peek inside an engine, I noticed that many have spiral marks painted in the center. What is the purpose of these?
The benefit of these white markings inside the engine is twofold:
The ground crew can tell if the engine is running or not.
When an airplane is at the gate before departure, there are several personal attending the airplane. They would be loading luggage, refueling, removing waste products, loading food, etc. etc.. Not all of these people are in constant contact with the pilots and they can come very close to the engines. Although there are several precautionary measures taken before the pilots turn on the engines, it is a very clear visual indication by looking at the spirals to tell if the engines are running or not. Rotor or prop blades sometimes have their tips painted for the same reason.
The birds keep away.
During flight, when the engine is running, birds see the spinning spiral as opposed to just a black hole, and hence they stay away from it. It is like an anti-bird signal because if there was nothing in the middle it just looks like a cave or black void that birds tend to fly toward. Even though it looks like a blur to us, birds can see motion better. Wikipedia mentions this also:
... it appears as a white circle which discourages birds from flying into the engine.
Our aerospace engines have swirls painted onto their spinners in order to indicate when the engine is rotating while on the ground. In flight these swirls flicker as the engine rotates at high speed, scaring birds and allowing them to fly clear of the engine.
As a long time ramp agent for Delta and Southwest Airlines, I can tell you they are a critically necessary element to ground crew safety. Not only do they tell you the impeller in spinning, but once the human eye can no longer identify the swirl pattern, it is spinning with enough speed to be an induction hazard (it can suck you in).
When parking an airliner, the crew lead guides the aircraft using aircraft marshaling wands. When he/she turns both tip toward each other, the crew set chocks around the wheels. Then NOTHING happens until that crew lead can see those spinning spirals clearly in all engines. Then and ONLY then, does that lead clear the crew to continue operations and begins comms with the flight crew.
The spiral on many GE engines is a stylized "G":
Rolls Royce has a longer spiral.
The design helps with ground crew safety, as Farhan's answer discusses. However, it is not required and not all engines have them, suggesting that they are also a matter of style between engines and manufacturers.
This page from Boeing about bird strikes says that there is no scientific evidence that spinner markings, airplane colors, landing lights, or weather radar deter birds. On the other hand, the Museum of Flight states that "research has shown" the spiral deters birds. Though I suppose this research could have been unscientific.
The AOPA says that "one air carrier detected slightly reduced bird strike rates after painting the jet engine spinners white." If there is indeed an effect here, it would seem that a spiral would be less effective than painting them white.
This paper notes mixed results on using eye spots on aircraft. When used on the ground, the birds seem to get used to them quickly, just as they do with the noise.
As costly as bird strikes can be, it would seem that aircraft operators would widely adopt anything shown to help prevent them.