To study the origin of far-IR emission in starburst nuclei (SBNs) and active galactic nuclei (AGNs), the 25-60-mu-m spectral index [alpha(25, 60)] has been compared with the intensity ratios of [O I] lambda-6300 to H-alpha ([O I]/H-alpha) and H-2 upsilon = 1-0 S(1) 2.12-mu-m to Br-gamma [S(1)/Br-gamma] for 48 galaxies (16 SBNs, 27 AGNs, and five LINERs). In SBNs, alpha(25, 60) correlates tightly with [O I]/H-alpha and with S(1)/Br-gamma. To explain the correlations, we adopt the following excitation mechanisms: (1) 25-mu-m emission is emitted by dust in ionized gas heated by Ly-alpha and ionizing photons; (2) 60-mu-m emission is emitted by dust in molecular clouds heated by nonionizing photons; and (3) [O I] and S(1) are excited by supernova-driven shocks. Nonionizing photons are from stars with M greater-than-or-equal-to 5 M. (supernova progenitors), while ionizing photons are from stars with M greater-than-or-equal-to 20 M.. Hence, with an increase in the number of stars with M < 20 M. relative to stars with M greater-than-or-equal-to 20 M., the 25-60-mu-m slope becomes steeper, and the ratios of [O I]/H-alpha and S(1)/Br-gamma become larger. On the other hand, AGNs scatter widely in the plots of alpha(25, 60) versus [O I]/H-alpha and of alpha(25, 60) versus S(1)/Br-gamma. In these plots, AGNs with starburst activity tend to have steep 25-60-mu-m slopes, and obey the alpha(25, 60)-[O I]/H-alpha [and alpha(25, 60)-S(1)/Br-gamma] correlation obtained for SBNs. Hence far-IR emission in AGNs is a mixture of the flat component from a nonthermal source and the steep component from dust heated by young stars, with their fractions varying from one to another. Notably, some AGNs have steeper 25-60-mu-m slopes than SBNs, indicating the predominance of stars with M < 20 M.. This trend may suggest the difference in star-forming activity between SBNs and AGNs.