For Civil War records it's important to know which side the ancestor served on since records are kept in different ways.
In general,
The compiled military service file maintains muster rolls. This is typically a monthly roll call to see which soldiers were present with their company on that date. If a solider was present in June, but not in July, the July muster usually tells why (killed, injured, imprisoned, or AWOL). The muster roll nor the compiled service records do not usually tell all of the battles the soldier was involved in, as these types of records simply weren't kept on a soldier by soldier basis.
Compiled service records are available at NARA for soldiers in the Regular U.S. Army and Confederate States armed forces. Many soldiers were state guard or local militia. These records are kept at the state level.
The compiled service record will also tell of some other unique events, such as imprisonments, hospitalizations, and payroll receipts.
Using the compiled service record (especially the muster rolls) to know when he was present with the unit, you can research that unit's battle history. Chances are, if your ancestor was with the unit at the time he served in the battle.
Unless something very odd happened, you won't find a record that is at the level of detail "John Smith pulled his rifle and shot 4 times into the air, then charged forward, tripping over a stone before proceeding, and stabbed an enemy." In battle, no one has time to write down this kind of detail about 1 person. You will find general details of the battle, and may find references to unique acts of valor and/or officers.
Some units have historical texts written about them. You can search these books for your ancestor's name. Even if he is not mentioned by name, the text will give some insight into where he was, what it was like, what battles he would have served in, and what happened at those battles. Many texts include extracts from journals and letters. If you're super-lucky your ancestor may be mentioned in one of these.
Another possible way of searching is to look for pension applications. They don't give a battle history, but there might be a unique mention of a certain battle in his file. This is especially true if he was injured or imprisoned in battle.