Most of the existing multi-lead electrocardiogram (ECG) detection methods are based on all 12 leads, which undoubtedly results in a large amount of calculation and is not suitable for the application in portable ECG detection systems. Moreover, the influence of different lead and heartbeat segment lengths on the detection is not clear. In this paper, a novel Genetic Algorithm-based ECG Leads and Segment Length Optimization (GA-LSLO) framework is proposed, aiming to automatically select the appropriate leads and input ECG length to achieve optimized cardiovascular disease detection. GA-LSLO extracts the features of each lead under different heartbeat segment lengths through the convolutional neural network and uses the genetic algorithm to automatically select the optimal combination of ECG leads and segment length. In addition, the lead attention module (LAM) is proposed to weight the features of the selected leads, which improves the accuracy of cardiac disease detection. The algorithm is validated on the ECG data from the Huangpu Branch of Shanghai Ninth People’s Hospital (defined as the SH database) and the open-source Physikalisch-Technische Bundesanstalt diagnostic ECG database (PTB database). The accuracy for detection of arrhythmia and myocardial infarction under the inter-patient paradigm is 99.65% (95% confidence interval: 99.20–99.76%) and 97.62% (95% confidence interval: 96.80–98.16%), respectively. In addition, ECG detection devices are designed using Raspberry Pi, which verifies the convenience of hardware implementation of the algorithm. In conclusion, the proposed method achieves good cardiovascular disease detection performance. It selects the ECG leads and heartbeat segment length with the lowest algorithm complexity while ensuring classification accuracy, which is suitable for portable ECG detection devices.