Environmental fluctuations can select for generalism, which is also hypothesized to increase organisms’ ability to invade novel environments. Here, we show that across a range of temperatures, opportunistic bacterial pathogen Serratia marcescens that evolved in fluctuating temperature (daily variation between 24°C and 38°C, mean 31°C) outperforms the strains that evolved in constant temperature (31°C). The growth advantage was also evident in novel environments in the presence of parasitic viruses and predatory protozoans, but less clear in the presence of stressful chemicals. Adaptation to fluctuating temperature also led to reduced virulence in Drosophila melanogaster host, which suggests that generalism can still be costly in terms of reduced fitness in other ecological contexts. While supporting the hypothesis that evolution of generalism is coupled with tolerance to several novel environments, our results also suggest that thermal fluctuations driven by the climate change could affect both species’ invasiveness and virulence.