Usually, this kind of problem is due to an issue with the control loop of the temperature. You can try to do PID Tuning by running the command
M303 E0 S200 C8. This will heat up the hot end and cycle it around 200C a few times, and afterwards tell you Kp, Ki and Kd values which you need to enter into the PID settings of your firmware configuration, or store them in EEPROM using
If this does not solve the problem, then disconnect the heater cartridge and check its resistance with a multimeter. For a 12V system, it should not be higher than 6Ω (24Ω for a 24V system).
If the heater cartridge is okay, then perhaps it is a problem with the power supply. While the hotend is heating up, measure the voltage across the heater cartridge. It should not be much less than the nominal 12V/24V your printer runs at. If it is, you may have a bad MOSFET or power supply.
Finally, if you have a very powerful fan blowing on the hotend this can cause issues with heating up as well. Adding a fan shroud (or pointing the fan away from the nozzle and only at the print) can help with this.