Renouncing ungodliness appears here in an interesting context. People in the congregation were getting into heated discussions about genealogies, meanings of words, and technicalities of law. Paul called this "ungodliness" (or irreligion) and instructed Timothy to shun such things. These brethren had missed the point of God's way of life, which Paul says is righteousness, joy, and peace in the Holy Spirit (Romans 14:17). Being technically correct about a minor point is not as important as building right relationships through kindness, forgiveness, service, and sensitive concern for others.
The word also appears in Romans 1:18-32 within a broad denunciation of obvious ungodliness, shown as the fruit of an unholy marriage of idolatry and immorality. When grace truly comes into a person's life, he must consciously repudiate and utterly reject ungodliness. That is, he must rid himself of the leaven of those sins. It will not happen all at once, but one must make consistent effort in that direction.