Because your (laptop I'm guessing?) will go into a balanced/power saver mode when it's unplugged which lowers performance to save battery power. When it's plugged in your battery settings will probably be on high performance so you'll have higher FPS. To fix this go into Power Options and select High Performance when it's not plugged in, this should fix your performance however it will drain the battery quicker.