The affinity is the level of the relationship between Elena and Aeron. The current level of the affinity is shown by a flowing dual helix bar on the left side of the screen whilst in the Observatory. The bar rises along a column of 10 gold spots correlating with the level of the affinity. The colour and direction of the flow varies depending on Elena's current form, being gold and upwards for her human form or purple and downwards in her transformed states. The first time her affinity reaches each level she will give Aeron a present.
The level of the affinity at the end of the game determines which of the five endings occur. Higher the affinity levels lead to the happier endings, with levels 0-2 for D, 3-4 for C, 5-6 for B, 7-8 for A and 9-10 for S (note the 6th Bad ending can occur regardless of the affinity level if Aeron does not return in time with flesh).
There are a few ways to change the level of the affinity. The main ways are to chat with Elena and give her gifts, but the sooner you return to the Observatory from the Towers, the more the affinity will raise. Sometimes you will have a multiple choice reply. Depending on your choice, the affinity will rise or fall by a different amount. During the game, scenes will occur in the Observatory with regards to Elena's routine which also can raise or lower the affinity. Giving Elena certain gifts will give you extra benefits in return. For example, for giving her a specific leather item she will sew it onto your bag, increasing the number of items it can hold. Other gifts may change the layout of the Observatory, alter Elena's appearance or affect her routine.
The fastest way to reduce affinity (to achieve lower affinity endings) is to gift Elena "disgusting" items such as the large bone. The large bone is not lost when doing this. Since it is so much easier to lose affinity than to gain it, consider saving and copying your file before reducing your affinity. Also remember that the D ending occurs before the final tower.